csvrows
csvrows OPTIONS [ARGS_AS_ROW_VALUES]
csvrows converts a set of command line args into rows of CSV formated output. It can also be used to filter or list specific rows of CSV input The first row is 1 not 0. Often row 1 is the header row and csvrows makes it easy to output only the data rows.
Simple usage of building a CSV file one rows at a time.
csvrows "First,Second,Third" "one,two,three" > 4rows.csv
csvrows "ein,zwei,drei" "1,2,3" >> 4rows.csv
cat 4row.csv
Example parsing a pipe delimited string into a CSV line
csvrows -d "|" "First,Second,Third|one,two,three" > 4rows.csv
csvrows -delimiter "|" "ein,zwei,drei|1,2,3" >> 4rows.csv
cat 4rows.csv
Filter a 10 row CSV file for rows 1,4,6 (top most row is one)
cat 10row.csv | csvrows -row 1,4,6 > 3rows.csv
Filter a 10 row CSV file for rows 1,4,6 from file named “10row.csv”
csvrows -i 10row.csv -row 1,4,6 > 3rows.csv
Filter 3 randomly selected rows from 10row.csv rendering new CSV with a header row from 10row.csv.
csvrows -i 10row.csv -header=true -random=3
csvrows 1.2.10