SCOLS-FILTER(5) Filformat och konventioner SCOLS-FILTER(5) NAMN scols-filter - syntax for libsmartcols filteruttryck SYNTAX 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 integer: [0-9]* | [0-9]*[KMGTPEZY] | [0-9]*[KMGTPEZY]iB float: integer.integer boolean: "true" | "false" | "TRUE" | "FALSE" string: "[^\n\"]*" | '[^\n\']*' holder: [a-zA-Z][a-zA-Z_.%:/\-0-9]* BESKRIVNING 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 NAME,LABEL,FSTYPE --filter 'NAME=="sda1"' helps lsblk(1) to not read LABELs for all block device from udevd or libblkid, but read it only for device sda1. Filtret kan ocksa anvandas for kolumner som inte anvands i utdata. SYNTAXANTECKNINGAR Ett uttryck bestar av holders, params och operatorer. 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 anvands for att representera ett varde direkt. De datatyper som for narvarande stods ar integer, float, string och boolean. 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. Operatorer som tar tva operander ar and, or, eq, ne, le, lt, ge, gt, =~, !~. Alfabetiskt namngivna operatorer har C-spraksanpassade alias: &&, ||, ==, !=, <, <=, >= och >. ! 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. Prioriteterna inom operatorer ar or, and, och eq, ne, le, gt, ge, =~, !~, not. BEGRANSNINGAR Nar det galler typvardena float och integer stoder filtermotorn endast icke-negativa tal. integer ar ett osignerat 64-bitars tal och float ar en lang dubbel. Heltal kan foljas av de multiplikativa suffixen KiB, GiB, TiB, PiB, EiB, ZiB och YiB (iB ar valfritt, t.ex. har "K" samma betydelse som "KiB"). UPPHOVSPERSONER Karel Zak Baserat pa originalimplementationen fran Masatake YAMATO . FELRAPPORTERING For felrapporter, anvand felhanteraren . TILLGANGLIGHET Biblioteket libsmartcols ar en del av paketet util-linux sedan version 2.25. Det kan laddas ner fran Linux Kernel Archive . util-linux 2.42.1 2026-05-18 SCOLS-FILTER(5)