The erase command is used to remove fields from CSV records using regular expressions to specify the fields to remove.


See also: exclude


Flag

Req'd?

Description

-f fields

No

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


 -f 3:6


and:


 -f 3,4,5,6


do the same thing. If no fields are specified, all fields are considered for removal.

-r regex

No

Test the fields specified by -f against the regular expression. If the expression matches, the fields are removed. Multiple -r options can be used; if any match, the fields are removed.


-n regex

No

As for -r, but remove fields that do not match the expression.


-k

No

Keep records where all fields have been removed as a blank line. By default such lines are removed from the output.


For example, this command:


     csvfix erase -f 1:3 -r '^[A-Za-z]' foo.csv


removes any of the first three fields in the input where the field begins with an alphabetic character.


Created with the Personal Edition of HelpNDoc: Easily create EBooks