±filter
Filtering data row input or output
Description
+filter Restricts reading the data rows from input to work only on to those that comply to the filter condition.-filter Inhibits writing output from a data row which does not comply to the filtering restriction. So only compliant data rows will be written to the output.
Filter restrictions are described using one or two operands and an operator in between.
Each of the operands may be a [Field] or an {expression}.
Before comparing, each expression and each field value will be resolved for each line, see Expressions and their Resolving. The comparison is then carried out with the resolved values.
Regarding all details about conditions, see also Filtering and Command Conditions.
Pattern
±filter={Operand}Operator{Operand}
Usage Examples
- +filter[3]
- Only reads this data row in if the third column is not empty.
- -filter[Status]!={Locked}
- Only outputs this data row if the column "Status" is not exactly equal to "Locked".
- -filter[Fruit]!c:{Apple/Pear}
- Only outputs this data row if the text in column "Fruit" contains neither "Apple" nor "Pear".
- -filter(NumericExpression1)ng:(NumericExpression2)
- Only outputs this data row if NumericExpression1 is larger than NumericExpression2.
"NumericExpression1" and "NumericExpression2" are resolved before the comparison takes place.
All Filter conditions
Tests for emptyness
-filter[Field] -filter[Field]!= |
string, [Field] is not empty. |
-filter[Field]! -filter[Field]= |
string, [Field] is empty. |
-filter([Field]) -filter([Field])!=0 |
numeric, [Field] is not empty and not 0. |
-filter([Field])! -filter([Field])=0 |
numeric, [Field] is empty or equal 0. |
String literal tests (alphabetical comparison)
-filter[Field]e:{expression} | [Field] and {expression} are equal. |
-filter[Field]!e:[Another Field] | {Field] and [Another Field] are not equal. |
-filter[Field]l:{expression} | [Field] is alphabetically lesser than {expression}. |
-filter[Field]!l:[Another | [Field] is alphabetically not lesser, i.e. greater/equal than [Another Field]. |
-filter[Field]g:{expression} | [Field] is alphabetically greater than {expression}. |
-filter[Field]!g:[Another Field] | [Field] is alphabetically not greater, i.e. lesser/equal than [Another Field]. |
-filter[Field]c:{expression} | [Field] contains {expresssion}. |
-filter[Field]!c:{expression} | [Field] does not contain {expresssion}. |
-filter[Field]b:{expression} | [Field] begins with {expression}. |
-filter[Field]!b:{expression} | [Field] does not begin with {expression}. |
-filter[Field]f:{expression} | [Field] finishes with {expression}. |
-filter[Field]!f:{expression} | [Field] does not finish with {expression}. |
-filter[Field]r:/expression/ | regex match, [Field] matches {expression}. |
-filter[Field]!r:/expression/ | no regex match, [Field] does not match {expression}. |
Numeric tests (numerical comparison)
-filter([Field])e:(7.3) -filter([Field])=(7.3) |
[Field] value is equal to 7.3, rounded to max. 27 decimal places. |
-filter([Field])ne:(3) -filter([Field])!=(3) |
Field value is not equal to 3. |
-filter([Field])ne:([Another Field]) -filter([Field])!=([Another Field]) |
[Field] and [Another Field] values are not equal. |
-filter([Field])g:([Another Field]) -filter([Field])>([Another Field]) |
[Field] is greater than [AnotherField]. |
-filter([Field])l:([Another Field]) -filter([Field])<([Another Field]) |
[Field] is lesser than [AnotherField]. |
-filter([Field])!g:[([Another Field]) -filter([Field])<=([Another Field]) |
[Field] is not greater, i.e. lesser/equal than [AnotherField]. |
-filter([Field])!l:([Another Field]) -filter([Field])>=([Another Field]) |
[Field] is not lesser, i.e. greater/equal than [AnotherField]. |
-filter([Field])gl:([Field1])/([Field2]) -filter([Field])<>([Field1])/([Field2]) |
[Field] is greater than [Field1] and lesser than [Field2]. |
-filter([Field])gel:([Field1])/([Field2]) -filter([Field])<=>([Field1])/([Field2]) |
[Field] is equal or greater than [Field1] and equal or lesser than [Field2]. |
-filter([Field])lg([Field1])/([Field2]) -filter([Field])><([Field1])/([Field2]) |
[Field] is either lesser than [Field1], or greater than [Field2]. |
-filter([Field])leg([Field1])/([Field2]) -filter([Field])>=<([Field1])/([Field2]) |
[Field] is either equal or lesser than [Field1], or equal or greater than [Field2]. |
When a numeric [Field] is in a different format, an additional read-formatting ([Field]) hint must be used.
Use e.g. "([Field],)" if [Field] has a decimal comma, while local standard for decimal separator is a point. See also Reading and Formatting Numeric Fields.
For strings, the "i" modifier sets the conditions to not case-sensitive
This modifier can be appended to the filter command as /i mode.
-filter[Field]={expression} | [Field] and {expression} are equal. |
-filter/ |
[Field] and {expression} are equal, comparison not case-sensitive. |
-filter[Field]!=[Another Field] | [Field] and [Another Field] are not equal. |
-filter/ |
[Field] and [Another Field] are not equal, comparison not case-sensitive. |
If the separator character interferes with the expresssion, you can change the separator.
-filter/#[Field]r:#expression# | regex match, [Field] matches {expression} (with # separator). |
-filter/#[Field]!r:#expression# | no regex match, [Field] does not match {expression} (with # separator). |
When concatenating more right operands with a separator, multiple choices can be given on the right side
-filter[Field]=abc | [Field] is being compared with "abc". |
-filter[Field]=abc/abd/xyz | [Field] is being compared with "abc", "abd", and "xyz". |
-filter/#[Field]e:abc#abd#xyz | [Field] is being compared with "abc", "abd", and "xyz", using a "#" separator. |
-filter/:[Field]e:abc:abd:xyz | [Field] is being compared with "abc", "abd", and "xyz", using a ":" separator. |
-filter/#[Field]e:{expression}#[abd]#[XYZ] | [Field] is being compared with {expression}, and with fields [abd] and [XYZ], using a "#" separator. |
-filter/i#[Field]e:{expression}#[abd]#[XYZ] | [Field] is being compared with {expression}, and with fields [abd], and [XYZ]; comparison is not case-sensitive, and using a "#" separator. |
Multiple positive choices are OR-ed, multiple negative choices are being AND-ed:
-filter[Field]e:abc/def/ghi | [Field] contains "abc" or "def" or "ghi". |
-filter[Field]!c:abc/def/ghi | [Field] does not contains "abc" and also not "def" and also not "ghi"
(i.e., nor "abc" neither "def" neither "ghi"). |
Filters can be combined, i.e., more than one filter can be used for output (or input). In this case, all filters must be matched in order to allow input resp. output of the data row.