|
| 1 | + |
| 2 | +# USAGE |
| 3 | + |
| 4 | +## csvrows [OPTIONS] [ARGS_AS_ROW_VALUES] |
| 5 | + |
| 6 | +## SYNOPSIS |
| 7 | + |
| 8 | +csvrows converts a set of command line args into rows of CSV formated output. |
| 9 | +It can also be used to filter or list specific rows of CSV input |
| 10 | +The first row is 1 not 0. Often row 1 is the header row and %!s(MISSING) makes it |
| 11 | +easy to output only the data rows. |
| 12 | + |
| 13 | +## OPTIONS |
| 14 | + |
| 15 | + -d set delimiter character |
| 16 | + -delimiter set delimiter character |
| 17 | + -h display help |
| 18 | + -header display the header row (alias for '-rows 1') |
| 19 | + -help display help |
| 20 | + -i input filename |
| 21 | + -input input filename |
| 22 | + -l display license |
| 23 | + -license display license |
| 24 | + -o output filename |
| 25 | + -output output filename |
| 26 | + -row output specified rows in order (e.g. -row 1,5,2:4)) |
| 27 | + -rows output specified rows in order (e.g. -rows 1,5,2:4)) |
| 28 | + -skip-header-row skip the header row (alias for -row 2: |
| 29 | + -v display version |
| 30 | + -version display version |
| 31 | + |
| 32 | +## EXAMPLES |
| 33 | + |
| 34 | +Simple usage of building a CSV file one rows at a time. |
| 35 | + |
| 36 | +```shell |
| 37 | + csvrows "First,Second,Third" "one,two,three" > 4rows.csv |
| 38 | + csvrows "ein,zwei,drei" "1,2,3" >> 4rows.csv |
| 39 | + cat 4row.csv |
| 40 | +``` |
| 41 | + |
| 42 | +Example parsing a pipe delimited string into a CSV line |
| 43 | + |
| 44 | +```shell |
| 45 | + csvrows -d "|" "First,Second,Third|one,two,three" > 4rows.csv |
| 46 | + csvrows -delimiter "|" "ein,zwei,drei|1,2,3" >> 4rows.csv |
| 47 | + cat 4rows.csv |
| 48 | +``` |
| 49 | + |
| 50 | +Filter a 10 row CSV file for rows 1,4,6 (top most row is one) |
| 51 | + |
| 52 | +```shell |
| 53 | + cat 10row.csv | csvrows -row 1,4,6 > 3rows.csv |
| 54 | +``` |
| 55 | + |
| 56 | +Filter a 10 row CSV file for rows 1,4,6 from file named "10row.csv" |
| 57 | + |
| 58 | +```shell |
| 59 | + csvrows -i 10row.csv -row 1,4,6 > 3rows.csv |
| 60 | +``` |
| 61 | + |
| 62 | + |
| 63 | +csvrows v0.0.14 |
0 commit comments