NAME
App::csvtool::Expr - csvtool commands that evaluate expressions
EXPRESSIONS
Commands in this module operate on rows of data by evaluating expressions given as part of the command's arguments. Expressions are built up from the following forms:
Numerical constants
Integers (e.g.
123) or decimal floats (e.g.12.345)Field references
F[nnn], where thennnpart gives the field index. Note that fields are indexed from 1 onwards.Parenthesized expressions
Any expression may be surrounded by parens (
( expr... )) to override precedence orderNumerical binary operators
Mathematical operators (
+ - * /) in their usual precedence orderNumerical comparison operators
Numerical comparisons (
== != < <= >= >)Logical binary operators
Operators that compare the truth of expressions (
&& ||)
COMMANDS
extend
$ csvtool extend EXPR INPUT...
Appends an extra column to each row, containing the result of the evaluated expression on that row.
filter
$ csvtool filter EXPR INPUT...
Filter rows by the given expression, which is evaluated for each row. Rows for which the expression is true are emitted unchanged; rows for which it is false are skipped.
TODO
Define many more operators. Functions. String operations. Allsorts...
AUTHOR
Paul Evans <leonerd@leonerd.org.uk>