select_columns "field_separator" "column_list"
The following CSV data received via pipe
cat<<EOM | select_columns ";" "CNT;ZIP;CITY" 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:
CNT;ZIP;CITY; USA;93117;Goleta; CH;8222;Beringen; RSA;8222;Cape Town;
The columns CNT, ZIP and CITY of the CSV data are selected using the select_columns command and then formatted to a list using the print_list(3) 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.