print_list [ "field_separator" [ indent ]]
The first row is treated as header row. The width of all columns is dynamically adjusted to the row containing the longest column entry.
Text columns are aligned to the left, bare number columns are aligned to the right.
Furthermore the output is limited to the current terminal width if the environment variable $PRINT_FIT2WIDTH is not set to False.
To select named columns from the CSV data prior to the formatting of the list with print_list use select_columns(3).
The following CSV data received via pipe
cat<<EOM | print_list ZIP;CITY;STATE;CNT;COUNTRY 93117;Goleta;CA;USA;United States of America 8222;Beringen;SH;CH;Switzerland 8005;Cape Town;WC;RSA;South Africa EOM
results in the output:
ZIP CITY STATE CNT COUNTRY ----- --------- ----- --- ------------------------ 93117 Goleta CA USA United States of America 8222 Beringen SH CH Switzerland 8005 Cape Town WC RSA South Africa (3)
The columns CNT, ZIP and CITY of the CSV data are selected using the select_columns(3) command and then formatted to a list using the print_list command
cat<<EOM | select_columns ";" "CNT;ZIP;CITY" | print_list ZIP;CITY;STATE;CNT;COUNTRY 93117;Goleta;CA;USA;United States of America 8222;Beringen;SH;CH;Switzerland 8005;Cape Town;WC;RSA;South Africa EOM what will result in the output: CNT ZIP CITY --- ----- --------- USA 93117 Goleta CH 8222 Beringen RSA 8005 Cape Town (3)
This is free software; see edrc/doc/COPYING for copying conditions. There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.