table of contents
- testing 2.41.3-4
- unstable 2.41.3-4
- experimental 2.42~rc1-3
| SCOLS-FILTER(5) | Формати датотека и конвенције | SCOLS-FILTER(5) |
НАЗИВ¶
scols-filter - синтакса за изразе „libsmartcols“ филтера
СИНТАКСА¶
expr: param
| ( expr )
| expr && expr | expr AND expr
| expr || expr | expr OR expr
| !expr | NOT expr
| expr == expr | expr EQ expr
| expr != expr | expr NE expr
| expr >= expr | expr GE expr
| expr <= expr | expr LE expr
| expr > expr | expr GT expr
| expr < expr | expr LT expr
| expr =~ string
| expr !~ string param: integer
| float
| string
| boolean
| holder цео број: [0-9]*
| [0-9]*[KMGTPEZY]
| [0-9]*[KMGTPEZY]iB float: integer.integer boolean: "true" | "false" | "TRUE" | "FALSE" ниска: "[^\n\"]*" | '[^\n\']*' држалац: [a-zA-Z][a-zA-Z_.%:/\-0-9]*
ОПИС¶
The filter expression can be used by application linked with libsmartcols to filter output data. The application can use the filter before it gathers all data for the output to reduce resources and improve performance. This makes scols filter more effective than grep(1) on the complete output. For example
lsblk --output НАЗИВ,НАТПИС,ВРСТАСД --filter 'НАЗИВ=="sda1"'
helps lsblk(1) to not read LABELs for all block device from udevd or libblkid, but read it only for device sda1.
Филтер се такође може користити за колоне које се не користе у излазу.
НАПОМЕНЕ СИНТАКСЕ¶
Израз се састоји од држалаца, параметара и оператора.
The currently supported holder type is column name only. The name has to be used without quotes. Before evaluation, application maps column names in the given expression to the output table columns and assign column data type to the holder. The default type is "string".
„param“ је за директно представљање вредности. Тренутно подржане врсте података су цели бројеви, децимални, ниске и логичке вредности.
An operator works with one or two operand(s). An operator has an expectation about the data type(s) of its operands. Giving an unexpected data type to an operator causes a syntax error. The library can cast between data types, the preferred is always the type as specified by param and in case of expression with number and float the preferred is the float.
Оператори који могу имати два операнда су „and“, „or“, „eq“, „ne“, „le“, „lt“, „ge“, „gt“, „=~“, „!~“. Азбучним редом именовани оператори имају алијасе у Ц-језику: „&&“, „||“, „==“, „!=“, „<“, „⇐“, „>=“, и „>“.
! is the only operator that takes one operand. If no operator is specified then expression is true if param or holder are not empty. For example --filter NAME will return lines where column NAME is not empty.
=~ and !~ is for regular expression matching; if a string at the right side matches (or not matches for !~ a regular expression at the left side), the result is true. The right side operand must be a string literal.
Предности у операторима су „or“, „and“, и „eq“, „ne“, „le“, „gt“, „ge“, „=~“, „!~“, „not“.
ОГРАНИЧЕЊА¶
О „float“ и „integer“ вредностима врсте, погон филтера подржава само не-негативне бројеве. „integer“ је беззнаковни 64-битни број, а „float“ је дуги дупли. После „integer“-а могу да стоје мултипликативни суфикси KiB, GiB, TiB, PiB, EiB, ZiB, и YiB („iB“ је изборно, нпр., „K“ има исто значење као „KiB“).
АУТОРИ¶
Карел Зак <kzak@redhat.com>
Засновано на изворној примени од Masatake YAMATO <yamato@redhat.com>-а.
ПРИЈАВЉИВАЊЕ ГРЕШАКА¶
За пријављивање грешака, користите „https://github.com/util-linux/util-linux/issues[issue tracker]“.
ДОСТУПНОСТ¶
Библиотека libsmartcols је део „util-linux“ пакета још од издања 2.25. Може се преузети са Архиве Линукс кернела <https://www.kernel.org/pub/linux/utils/util-linux/>.
| 2026-03-22 | util-linux 2.42-rc1 |