Caltech Library logo

csvcols

USAGE

csvcols [OPTIONS] ARGS_AS_COLS

SYNOPSIS

csvcols converts a set of command line args into columns output in CSV format. It can also be used to filter input CSV and rendering only the column numbers listed on the commandline (first column is 1 not 0)

OPTIONS

	-col	filter CSV input for columns requested
	-d	set delimiter for conversion
	-delimiter	set delimiter for conversion
	-filter-columns	filter CSV input for columns requested
	-h	display help
	-help	display help
	-i	input filename
	-input	input filename
	-l	display license
	-license	display license
	-o	output filename
	-output	output filename
	-v	display version
	-version	display version

EXAMPLES

Simple usage of building a CSV file one row at a time.

    csvcols one two three > 3col.csv
    csvcols 1 2 3 >> 3col.csv
    cat 3col.csv

Example parsing a pipe delimited string into a CSV line

    csvcols -d "|" "one|two|three" > 3col.csv
    csvcols -delimiter "|" "1|2|3" >> 3col.csv
    cat 3col.csv

Filter a 10 column CSV file for columns 1,4,6 (left most column is number zero)

    cat 10col.csv | csvcols -col 1 4 6 > 3col.csv

Filter a 10 columns CSV file for columns 1,4,6 from input file

    csvcols -i 10col.csv -col 1 4 6 > 3col.csv