txdrows - split a section of sets out of singe data file
pipe | txdrows -b=3 -e=10 | pipe
pipe | txdrows 'near([1], 3.1)' | pipe
This program extracs rows (data sets, sections, records, ...) of a numerical text file. Either this is a configured range of lines via begin/end indices or a decimation factor, or a set of rows matching a given expression on the command line. The last example employs such an expression to match the first row that has a value near 3.1 in the first column. You could specify a third argument to near() to change the default allowed deviation. If you deal with integer values, using
pipe | txdrows '[1] == 3' | pipe
is fine, too, for selecting value 3.
These are the general rules for specifying parameters to this program:
txdrows -s -xyz -s=value --long --long=value [--] [files/stuff]
You mention the parameters/switches you want to change in any order or even multiple times (they are processed in the oder given, later operations overriding/extending earlier settings. An only mentioned short/long name (no "=value") means setting to 1, which is true in the logical sense. Also, prepending + instead of the usual - negates this, setting the value to 0 (false). Specifying "-s" and "--long" is the same as "-s=1" and "--long=1", while "+s" and "++long" is the sames as "-s=0" and "--long=0".
There are also different operators than just "=" available, notably ".=", "+=", "-=", "*=" and "/=" for concatenation / appending array/hash elements and scalar arithmetic operations on the value. Arrays are appended to via "array.=element", hash elements are set via "hash.=name=value".
The available parameters are these, default values (in Perl-compatible syntax) at the time of generating this document following the long/short names:
1
begin of section
0
ignore whitespace at beginning and end of line (disables strict mode) (from Text::NumericData)
undef
comment character (if not set, deduce from data or use #) (from Text::NumericData)
'[#%]*[^\\S\\015\\012]*'
regex for matching comments (from Text::NumericData)
[]
Which configfile(s) to use (overriding automatic search in likely paths); special: just -I or --config causes printing a current config file to STDOUT
treat empty lines as empty data sets, preserving them in output (from Text::NumericData)
-1
end of section (when negative: until end)
fill value for undefined data (from Text::NumericData)
show the help message; 1: normal help, >1: more help; "par": help for paramter "par" only
Additional fun with negative values, optionally followed by comma-separated list of parameter names: -1: list par names, -2: list one line per name, -3: -2 without builtins, -10: dump values (Perl style), -11: dump values (lines), -100: print POD.
if an expression to match is given, select what to print out: 0 means all matches including header, >0 means just the first n matches, <0 means all matches, but no header
line ending to use: (DOS, MAC, UNIX or be explicit if you can, taken from data if undefined, finally resorting to UNIX) (from Text::NumericData)
printf formats to use (if there is no "%" present at all, one will be prepended) (from Text::NumericData)
'[\\+\\-]?\\d*\\.?\\d*[eE]?\\+?\\-?\\d*'
regex for matching numbers (from Text::NumericData)
use this separator for output (leave undefined to use input separator, fallback to TAB) (from Text::NumericData)
quote titles (from Text::NumericData)
quote character to use (derived from input or ") (from Text::NumericData)
'1'
Redunce row count by a certain factor: Only include every ...th one. A value of 2 means rows 1,3,5... , a value of 10 means rows 1,11,21... (from the beginning).
use this separator for input (otherwise deduce from data; TAB is another way to say "tabulator", fallback is ) (from Text::NumericData)
strictly split data lines at configured separator (otherwise more fuzzy logic is involved) (from Text::NumericData)
allow text as data (not first column) (from Text::NumericData)
be verbose about things
print out the program version
Thomas Orgis <thomas@orgis.org>
Copyright (c) 2005-2013 Thomas Orgis, Free Software licensed under the same terms as Perl 5.10
To install Text::NumericData, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Text::NumericData
CPAN shell
perl -MCPAN -e shell install Text::NumericData
For more information on module installation, please visit the detailed CPAN module installation guide.