.ig >> TDHkit: fldsel(1)


Tabular data handling toolkit  


.>> .TH fldsel(1) TDH "19-SEP-2003 TDH scg@jax.org" .SH NAME fldsel(1) \- extract requested fields from a stream of data records .ig >>


.>> .SH SYNOPSIS \fCfldsel \fIoptions\fC \fIfield1 .. fieldN\fR .ig >>


.>> .SH DESCRIPTION \fBfldsel\fR is a filter utility that extracts (or suppresses) one or more \fIfields\fR 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 .ig >> .>> \0fldfmt(1). .ig >> .>> .LP \fIfield\fR may be an integer field position (where first field is 1), or a field name with -h or -H. \fIfield\fRs may be specified with or without a leading at-sign (@). .ig >>


.>> .SH OPTIONS .LP \fB-o\fR .IP \0 Omit fields instead of selecting fields. For instance, \fCfldsel -o 3 7\fR would print all fields except fields 3 and 7. -o may be used with -s. .ig >>

.>> .LP \fB-h\fR .IP \0 Header mode. A .ig >> .>> \0field name header line .ig >> .>> is expected. The header is not replicated in the output. .ig >>

.>> .LP \fB-H\fR .IP \0 Same as -h but field name header is also written to the output. .ig >>

.>> .LP \fB-t\fR .IP \0 Accept TAB-delimited fields (possibly containing embedded spaces) on input and write TAB-delimited fields to output. .ig >>

.>> .LP \fB-d\fR \fIC\fR .IP \0 Specifies the output field delimiter character. \fIC\fR may be the words \fCspace\fR or \fCtab\fR, or any single character. .ig >>

.>> .LP \fB-s\fR \fIrangespec\fR .IP \0 Specify fields using range notation. \fIrangespec\fR 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 \fIfield\fR arguments should be specified on the command line. Other examples: .RS .IP "1 14-last" would specify fields 1, 14, 15, etc. to the last field .br "1-5 10-12" would specify fields 1, 2, 3, 4, 5, 10, 11, 12. .br There may be no embedded spaces in the dash construct. .ig >>


.>> .SH EXAMPLES .LP \fCcat people | fldsel -r people @firstname @lastname\fR .IP Take a stream of people records and extract two fields: \fBfirstname\fR, and \fBlastname\fR. .sp .LP \fCdbcat -h people | fldsel -H @firstname @lastname\fR .IP Take a stream of people records with field name header, and extract the fields \fBfirstname\fR, and \fBlastname\fR. The field name header is preserved in the result. .sp .LP \fCcat data | fldsel @5 @8 @9 .IP Take a stream of records and print the 5th, 8th, and 9th fields, .sp .LP \fCcat data | fldsel -s "1,2 14-last" \fR .IP Take a stream of records and print fields 1, 2, then 14, 15, etc. through the last field on each record. .sp .LP \fCcat data | fldsel -o -s "9-12 17" \fR .IP Take a stream of records and print all fields except fields 9 through 12, and field 17. .ig >>


.>> .SH NOTES .LP If a specified \fIfield\fR is unrecognized, the symbol \fBNOT-FOUND\fR will be written. .ig >>


Tabular data handling toolkit 
Copyright Steve Grubb
.>>