NAME
App::csvtool
- implements the csvtool core commands
DESCRIPTION
This module provides the main commands for the csvtool wrapper script.
COMMANDS
cut
$ csvtool cut -fFIELDS INPUT...
Extracts the given field column(s).
--fields, -f
A comma-separated list of field indexes (defaults to 1).
A field index of u
will result in an undefined (i.e. empty) field being emitted. This can be used to create spaces and pad out the data.
grep
$ csvtool grep PATTERN INPUT...
Filter rows by the given pattern. The pattern is always interpreted as a Perl regular expression.
--ignore-case, -i
Ignore case when matching.
--invert-match, -v
Output only the lines that do not match the filter pattern.
head
$ csvtool head -nLINES INPUT...
Output only the first few rows.
--lines, -n
Number of lines to output. If negative, will output all but the final few rows of the given number.
join
$ csvtool join -fFIELD FILE1 FILE2
Reads two files and outputs rows joined by a common key.
The second file is read entirely into memory and indexed by its key field. Then the first file is read a row at a time, and each row has the corresponding data from the second file appended to it when output.
This is more flexible than the join(1) UNIX tool that inspires it, because FILE2
does not need to be sorted in key order in the same way as FILE1
. Additionally, rows of FILE2
may be emitted zero, one, or more times as required by matches from FILE1
.
--field1, -1
The field index in FILE1 to use as the lookup key.
--field2, -2
The field index in FILE2 to use as the storage key.
--field, -f
Use the same field index for both files.
sort
$ csvtool sort INPUT...
Sorts the rows according to the given field.
--field, -f
The field index to sort by (defaults to 1).
--numerical, -n
Sorts numerically. If absent, sorting happens alphabetically.
--reverse, -r
Reverses the order of sorting.
tail
$ csvtool tail -nLINES INPUT...
Output only the final few rows.
--lines, -n
Number of lines to output. If negative, will output all but the first few rows of the given number.
uniq
$ csvtool uniq -fFIELD INPUT...
Filters rows for unique values of the given field.
--field, -f
The field index to select rows on (defaults to 1).
AUTHOR
Paul Evans <leonerd@leonerd.org.uk>