14.4.4 How to specify row filters
You can display only the rows that satisfy conditions by specifying the conditions in the --filter option.
When conditions are evaluated, values that are not displayed are treated as if they were displayed. Cells with no data are treated as null character strings.
If a specified condition is invalid, command execution fails.
- Organization of this subsection
(1) Option specification format (BNF notation)
--filter filter-condition filter-condition ::= row-condition row-condition ::= column-condition|column-condition logical-operator column-condition column-condition ::= column-name comparison-operator-(character-string) character-string |column-name comparison-operator-(numeric-value) numeric-value logical-operator ::= "&&"|"||" comparison-operator-(character-string) ::= "=="|"!=" comparison-operator-(numeric-value) ::= ">"|"<"|">="|"<=" character-string ::= String-character-string numeric-value ::= numeric-value-that-can-be-converted-by-Long.parseLong()
- Important note
-
Enclose the entire condition in double quotation marks (") in the following cases
-
column-name or character-string contains a space.
-
comparison-operator-(numeric-value) is specified.
If such a condition is not enclosed in double quotation marks ("), it might be treated as separate arguments or redirected incorrectly.
-
- Reference note
-
How to interpret the BNF notation
The item on the left of ::= is to be specified in the format shown by the items on the right. The following example explains the specification format of filter-condition:
-
filter-condition::=row-condition means that filter-condition is to be specified in the format row-condition.
-
row-condition::=column-condition|column-condition logical-operator column-condition means that row-condition is to be specified in the format column-condition or the format column-condition logical-operator column-condition.
-
From 1 and 2, filter-condition must be specified in the format column-condition or the format column-condition logical-operator column-condition.
-
(2) Arguments
(a) filter-condition
This argument specifies row-condition.
(b) row-condition
This argument specifies column-condition or column-condition logical-operator column-condition.
(c) column-condition
This argument specifies column-name comparison-operator-(character-string) character-string or column-name comparison-operator-(numeric-value) numeric-value.
(d) column-name
This argument specifies column names for the content to be displayed.
Column names can be specified regardless of whether they are specified in the --columns option. However, the names of columns that are not displayed cannot be specified regardless of the --columns option. For example, the names of columns that are displayed only when the -v option is specified cannot be specified if the -v option is not specified.
(e) logical-operator
You can specify the logical operators shown in the table below.
If multiple logical operators are specified, they are evaluated sequentially from left to right.
No. |
Logical operator |
Example |
Description |
---|---|---|---|
1 |
&& |
A && B |
A and B (If A and B are both true, the condition is true; otherwise, the condition is false) |
2 |
|| |
A || B |
A or B (If A and B are both false, the condition is false; otherwise, the condition is true) |
(f) comparison-operator-(character-string)
You can specify the comparison operators shown in the following table.
No. |
Comparison operator |
Example |
Description |
---|---|---|---|
1 |
== |
A == B |
Whether the pattern of character string A matches the pattern of character string B (case-sensitive) |
2 |
!= |
A != B |
Whether the pattern of character string A does not match the pattern of character string B (case-sensitive) |
(g) comparison-operator-(numeric-value)
You can specify the comparison operators shown in the following table.
No. |
Comparison operator |
Example |
Description |
---|---|---|---|
1 |
> |
A > B |
Whether A as converted to a long value is greater than B as converted to a long value (if there is no data for A, the condition is false) |
2 |
< |
A < B |
Whether A as converted to a long value is less than B as converted to a long value (if there is no data for A, the condition is false) |
3 |
>= |
A >= B |
Whether A as converted to a long value is equal to or greater than B as converted to a long value (if there is no data for A, the condition is false) |
4 |
<= |
A <= B |
Whether A as converted to a long value is equal to or less than B as converted to a long value (if there is no data for A, the condition is false) |
(h) character-string
This argument specifies a String character string. You can use the two wildcards * and ?.
(i) numeric-value
This argument specifies a numeric value that can be converted by Long.parseLong().
(3) Execution example
This example specifies the --filter option in the eztool status -v command.
Displaying the EADS server IDs of the EADS servers that have 3,000 or more keys and the total number of keys
Displaying only parameters related to logs (output example is omitted)