The remove command behaves exactly like the find command except that only input records that do not match a regular expression are written to output. It is this similar to the UN*X grep -v command, except that it understands CSV records and fields.
See also: find
Flag |
Req'd? |
Description |
-f fields |
No |
Specifies a comma-separated list of field indices identifying the fields in th input which will be used by the filter. If the -f flag is not specified, all fields are used. |
-e expr |
No |
Specifies a regular expression which will be compared against the fields specified by the -f flag. If the expression matches, the record will not appear in the command output. You can specify more than one expression, in which case the record will be filtered out if any of them match. |
-ei expr |
No |
As for -e, but ignore case when performing comparison. |
-s str |
No |
As for -e, but do not treat str as regular expression. |
-si str |
No |
As for -ei, but do not treat str as regular expression. |
-n |
No |
Instead of outputting unmatched records outputs the number of non-matches . This is useful when using CSVfix in scripts. |
-r range |
No |
Specifies a range to search for. For example, -r 10:50 would search for numbers in the range 10 - 50 inclusive, while -r A:C would search for all strings that begin with A, B or C. If both elements of a range are numeric, then numeric searching is performed, and non-numeric values in the input will not be considered part of the range. |
-l length |
No |
Search for fields having specific lengths. Lengths may be specified as a single number or a range. |
-fc count |
No |
Specify that only rows with a certain number of fields will be removed. The field count can be specified as a single number or a range. For example, -fc 3 specifies rows with only three fields. whereas -fc 2:6 specifies rows containing between two and size fields inclusive. |
-if expr |
No |
Evaluates the expression expr using the same expression language used by the eval command for each row. If the expression evaluates to true, the row is removed. |
The following example removes British cities from cities.csv:
csvfix remove -f 2 -e 'GB' data/cities.csv
producing:
"Paris","FR"
"Amsterdam","NL"
"Rome","IT"
"Athens","GR"
"Berlin","DE"
Created with the Personal Edition of HelpNDoc: Easy EPub and documentation editor