gdbtek / linux-cookbooks

MIT License
145 stars 63 forks source link

Output of function printTable in util.bash is not filled with minus sign #45

Closed karmicdude closed 5 months ago

karmicdude commented 5 years ago

GNU bash, version 4.4.23(1)-release

cat test
HEADER 1,HEADER 2,HEADER 3
data 1,data 2,data 3
data 4,data 5,data 6

source util.bash

printTable ',' "$(cat test)"
+           +           +           +
| HEADER 1  | HEADER 2  | HEADER 3  |
+           +           +           +
| data 1    | data 2    | data 3    |
| data 4    | data 5    | data 6    |
+           +           +           +
gdbtek commented 5 years ago

thanks for reporting the issue, it's a bug and I'm taking a look at it.

schuebel commented 5 years ago

thanks for reporting the issue, it's a bug and I'm taking a look at it.

Any news?

gdbtek commented 5 years ago

@z-engine what OS did you use to see this issue?

schuebel commented 5 years ago

@gdbtek I'm seeing it on

Linux 4.12.14-95.6-default x86_64 SUSE Linux Enterprise Server 12 SP4

xiaoleeza commented 4 years ago

I have fix this bug on Centos7 output="$(echo -e "${table}" | column -s '#' -t | awk '/+/{gsub(" ", "-", $0)}1' | sed 's/^--\|^ //g')"

patrickernandes commented 3 years ago

I have de same bug on Debian 11 Sid. But the solution of @xiaoleeza not work for me. have any idea?

jxedge commented 2 years ago

This change works for me on Debian 11 output="$(echo -e "${table}" | column -s '#' -t | awk '/^ *\+/{gsub(" ", "-", $0)}1' | sed 's/^--\|^ / /g')"

j4rosz commented 1 year ago

This change works for me on Debian 11 output="$(echo -e "${table}" | column -s '#' -t | awk '/^ *\+/{gsub(" ", "-", $0)}1' | sed 's/^--\|^ / /g')"

Worked for me on macOS 13 and Raspberry Pi OS 11 bullseye, thanks

gdbtek commented 5 months ago

thanks @jxedge for the fix.