truncate

Commands ››
Parent Previous Next

The truncate command truncates CSV data by removing rightmost fields. The command will never add any fields, so truncating data which has rows containing fewer than the truncation value will not affect those rows in any way. In this way it behaves somewhat differently from the order command, which would append empty fields if none existed in the input.

See also: order, pad

Flag

Req'd?

Description

-n count

Yes

Specifies how many fields to truncate to.



The following example truncates the names.csv file to two fields per row:

csvfix truncate -n 2 data/names.csv

which produces:

"Charles","Dickens"
"Jane","Austen"
"Herman","Melville"
"Flann","O'Brien"
"George","Elliot"
"Virginia","Woolf"
"Oscar","Wilde"

Created with the Personal Edition of HelpNDoc: iPhone web sites made easy