linux-cookbooks icon indicating copy to clipboard operation
linux-cookbooks copied to clipboard

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

Open karmicdude opened this issue 5 years ago • 8 comments

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    |
+           +           +           +

karmicdude avatar Dec 10 '18 21:12 karmicdude

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

gdbtek avatar Dec 10 '18 21:12 gdbtek

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

Any news?

schuebel avatar Sep 05 '19 13:09 schuebel

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

gdbtek avatar Sep 07 '19 02:09 gdbtek

@gdbtek I'm seeing it on

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

schuebel avatar Sep 09 '19 06:09 schuebel

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

xiaoleeza avatar Jan 15 '20 13:01 xiaoleeza

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

patrickernandes avatar Mar 12 '21 13:03 patrickernandes

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

jxedge avatar Feb 20 '22 13:02 jxedge

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

j4rosz avatar Jul 14 '23 14:07 j4rosz

thanks @jxedge for the fix.

gdbtek avatar May 03 '24 06:05 gdbtek