DragonFly On-Line Manual Pages

Search: Section:  


fldsel(1)(TDH)                                                  fldsel(1)(TDH)

NAME

fldsel(1) - extract requested fields from a stream of data records

SYNOPSIS

fldsel options field1 .. fieldN

DESCRIPTION

fldsel is a filter utility that extracts (or suppresses) one or more fields from a stream of records. Records should be white-space delimited, newline terminated ascii text. The result fields are written to standard output. For more flexible output formatting, see fldfmt(1). field may be an integer field position (where first field is 1), or a field name with -h or -H. fields may be specified with or without a leading at-sign (@).

OPTIONS

-o Omit fields instead of selecting fields. For instance, fldsel -o 3 7 would print all fields except fields 3 and 7. -o may be used with -s. -h Header mode. A field name header line is expected. The header is not replicated in the output. -H Same as -h but field name header is also written to the output. -t Accept TAB-delimited fields (possibly containing embedded spaces) on input and write TAB-delimited fields to output. -d C Specifies the output field delimiter character. C may be the words space or tab, or any single character. -s rangespec Specify fields using range notation. rangespec contains a specification in range notation. For example, "1-6,7,10" would specify fields 1, 2, 3, 4, 5, 6, 7, and 10. If -s is used then no other field arguments should be specified on the command line. Other examples: "1 14-last" would specify fields 1, 14, 15, etc. to the last field "1-5 10-12" would specify fields 1, 2, 3, 4, 5, 10, 11, 12. There may be no embedded spaces in the dash construct.

EXAMPLES

cat people | fldsel -r people @firstname @lastname Take a stream of people records and extract two fields: firstname, and lastname. dbcat -h people | fldsel -H @firstname @lastname Take a stream of people records with field name header, and extract the fields firstname, and lastname. The field name header is preserved in the result. cat data | fldsel @5 @8 @9 Take a stream of records and print the 5th, 8th, and 9th fields, cat data | fldsel -s "1,2 14-last" Take a stream of records and print fields 1, 2, then 14, 15, etc. through the last field on each record. cat data | fldsel -o -s "9-12 17" Take a stream of records and print all fields except fields 9 through 12, and field 17.

NOTES

If a specified field is unrecognized, the symbol NOT-FOUND will be written. 19-SEP-2003 TDH scg@jax.org fldsel(1)(TDH)

Search: Section: