Dselect - Selection by a conditional expression

[ English | Japanese ]

SYNOPSIS

Dselect [ -F ] Dl-expression [input-file..]

Dsel is the short name (UNIX only) for Dselect.

DESCRIPTION

Dselect reads records from the input-files evaluating the Dl-expression, and when the result is TRUE, copies the input record to the standard output.

See the manual of Dl for the Dl-expression. The restriction for Dl-expression used in Dselect is that no modification of the input record or output to the file is allowed.

OPTIONS

-F
adds "filename" field to each output record; value is the input file name in the form of the command arguments after globbed by the shell. This field is not added when the input file is the standard input.

FIXED NAME FIELDS

filename:
at the top of each record, when -F option is specified..

EXAMPLES

Field "count" value is greater than 1:

Dselect count:n ">" 1
Dselect NUM FIELD count GT 1

(Above examples produce same result. Note that :n or NUM is required.)

Field "keywd" values have character string "database" or "DB" in it:

Dselect keywd =~ database OR keywd =~ DB

Same condition:

Dselect keywd =~ "{" database DB "}"

All of field "keywd" values are alphabet only words, starting with a capital letter, followed by small lettters:

Dselect NOT keywd UNLIKE "^[A-Z][a-z]+$"

(UNLIKE tests if there is at least one such value.)

Field "mark" value (exists at most one) has value *:

Dselect mark == CONST "*"

(You need CONST because "*" is a reserved word.)

Field "mark" value (exists at most one) has value + or *:

Dselect "{" "+" "*" "}" INCL FIELD mark

(Keyword FIELD is mandatory. Without it, "mark" becomes a constant.)

Extracting a record from every 100 records:

Dselect REC# % 100 == 1

Case insensitive search:

Dselect CAPS keywd =~ TOKYO

DIAGNOSTICS

See the manual of D_msg.

SEE ALSO

Dintro, Dextract, Dgrep, Dhead, Dtail, Dl, D_msg.

AUTHOR

MIYAZAWA Akira


miyazawa@nii.ac.jp
2003