'\" t .\" Title: scols-filter .\" Author: [see the "AUTHOR(S)" section] .\" Generator: Asciidoctor 2.0.26 .\" Date: 2026-05-18 .\" Manual: Filformat och konventioner .\" Source: util-linux 2.42.1 .\" Language: English .\" .TH "SCOLS\-FILTER" "5" "2026-05-18" "util\-linux 2.42.1" "Filformat och konventioner" .ie \n(.g .ds Aq \(aq .el .ds Aq ' .ss \n[.ss] 0 .nh .ad l .de URL \fI\\$2\fP <\\$1>\\$3 .. .als MTO URL .if \n[.g] \{\ . mso www.tmac . am URL . ad l . . . am MTO . ad l . . . LINKSTYLE blue R < > .\} .SH "NAMN" scols-filter \- syntax för libsmartcols filteruttryck .SH "SYNTAX" .sp .if n .RS 4 .nf .fam C 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: "[^\(rsn\(rs"]*" | \*(Aq[^\(rsn\(rs\*(Aq]*\*(Aq holder: [a\-zA\-Z][a\-zA\-Z_.%:/\(rs\-0\-9]* .fam .fi .if n .RE .SH "BESKRIVNING" .sp 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 \fBgrep\fP(1) on the complete output. For example .sp .if n .RS 4 .nf .fam C lsblk \-\-output NAME,LABEL,FSTYPE \-\-filter \*(AqNAME=="sda1"\*(Aq .fam .fi .if n .RE .sp helps \fBlsblk\fP(1) to not read LABELs for all block device from udevd or libblkid, but read it only for device sda1. .sp Filtret kan också användas för kolumner som inte används i utdata. .SH "SYNTAXANTECKNINGAR" .sp Ett uttryck består av holders, params och operatorer. .sp The currently supported \f(CRholder\fP 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". .sp \f(CRparam\fP används för att representera ett värde direkt. De datatyper som för närvarande stöds är integer, float, string och boolean. .sp 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 \f(CRparam\fP and in case of expression with number and float the preferred is the float. .sp Operatorer som tar två operander är \f(CRand\fP, \f(CRor\fP, \f(CReq\fP, \f(CRne\fP, \f(CRle\fP, \f(CRlt\fP, \f(CRge\fP, \f(CRgt\fP, \f(CR=~\fP, \f(CR!~\fP. Alfabetiskt namngivna operatorer har C\-språksanpassade alias: \f(CR&&\fP, \f(CR||\fP, \f(CR==\fP, \f(CR!=\fP, \f(CR<\fP, \f(CR\(lA\fP, \f(CR>=\fP och \f(CR>\fP. .sp \f(CR!\fP 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 \fB\-\-filter NAME\fP will return lines where column NAME is not empty. .sp \f(CR=~\fP and \f(CR!~\fP is for regular expression matching; if a string at the right side matches (or not matches for \f(CR!~\fP a regular expression at the left side), the result is true. The right side operand must be a string literal. .sp Prioriteterna inom operatorer är \f(CRor\fP, \f(CRand\fP, och \f(CReq\fP, \f(CRne\fP, \f(CRle\fP, \f(CRgt\fP, \f(CRge\fP, \f(CR=~\fP, \f(CR!~\fP, \f(CRnot\fP. .SH "BEGRÄNSNINGAR" .sp När det gäller typvärdena \f(CRfloat\fP och \f(CRinteger\fP stöder filtermotorn endast icke\-negativa tal. \f(CRinteger\fP är ett osignerat 64\-bitars tal och \f(CRfloat\fP är en lång dubbel. Heltal kan följas av de multiplikativa suffixen KiB, GiB, TiB, PiB, EiB, ZiB och YiB (iB är valfritt, t.ex. har "K" samma betydelse som "KiB"). .SH "UPPHOVSPERSONER" .sp .MTO "kzak\(atredhat.com" "Karel Zak" "" .sp Baserat på originalimplementationen från \c .MTO "yamato\(atredhat.com" "Masatake YAMATO" "." .SH "FELRAPPORTERING" .sp För felrapporter, använd \c .URL "https://github.com/util\-linux/util\-linux/issues" "felhanteraren" "." .SH "TILLGÄNGLIGHET" .sp Biblioteket \fBlibsmartcols\fP är en del av paketet util\-linux sedan version 2.25. Det kan laddas ner från \c .URL "https://www.kernel.org/pub/linux/utils/util\-linux/" "Linux Kernel Archive" "."