![]() |
![]()
| ![]() |
![]()
NAMEcsvcut - csvcut Documentation DESCRIPTIONFilters and truncates CSV files. Like the Unix "cut" command, but for tabular data: usage: csvcut [-h] [-d DELIMITER] [-t] [-q QUOTECHAR] [-u {0,1,2,3}] [-b] See also: Arguments common to all tools. NOTE: csvcut does not implement row filtering, for this you
should pipe data to csvgrep.
NOTE: If a data row is longer than the header row, its
additional columns are truncated.
EXAMPLESPrint columnsPrint the indices and names of all columns: $ csvcut -n examples/realdata/FY09_EDU_Recipients_by_State.csv Print only the names of all columns, by removing the indices with the cut command: $ csvcut -n examples/realdata/FY09_EDU_Recipients_by_State.csv | cut -c6- State Name State Abbreviate Code Montgomery GI Bill-Active Duty Montgomery GI Bill- Selective Reserve Dependents' Educational Assistance Reserve Educational Assistance Program Post-Vietnam Era Veteran's Educational Assistance Program TOTAL Extract columnsExtract the first and third columns: csvcut -c 1,3 examples/realdata/FY09_EDU_Recipients_by_State.csv Extract columns named "TOTAL" and "State Name" (in that order): csvcut -c TOTAL,"State Name" examples/realdata/FY09_EDU_Recipients_by_State.csv Extract a column that may not exist in all files: echo d, | csvjoin examples/dummy.csv - | csvcut -c d OtherAdd line numbers to a file, making no other changes: csvcut -l examples/realdata/FY09_EDU_Recipients_by_State.csv Display a column's unique values: csvcut -c 1 examples/realdata/FY09_EDU_Recipients_by_State.csv | sed 1d | sort | uniq Or: csvcut -c 1 examples/realdata/FY09_EDU_Recipients_by_State.csv | csvsql --query 'SELECT DISTINCT("State Name") FROM stdin' AUTHORChristopher Groskopf and contributors COPYRIGHT2016, Christopher Groskopf and James McKinney
|