exclude

Commands ››
Parent Previous Next

The exclude command is used to remove fields from CSV data. This can also be done with the order command, but exclude is more convenient when the data being processed contains records with variable numbers of fields, or when there are a large number of fields and you only want to exclude a few of them.


See also: order


Flag

Req'd?

Description

-f fields

No

Specifies a comma-separated list of field indices identifying the fields in the input which will be removed. You can use ranges to specify excluded fields, so;


-f 3:6


and:


-f 3,4,5,6


do the same thing.

-rf fields

No

As for -f, but fields are specified from the end of the CSV record, so:


-f 1,2


excludes the last two fields in the records.


Note one of -f or -rf must be specified, but not both.


-if expr

No

Evaluate expr using the eval expression language. If it evaluates to true, remove fields specified by -f.



The following example removes the surname field from the names.csv data:


csvfix exclude -f 2 data/names.csv


which produces:


"Charles","M"

"Jane","F"

"Herman","M"

"Flann","M"

"George","F"

"Virginia","F"

"Oscar","M"

Created with the Personal Edition of HelpNDoc: Easily create EPub books