![]() Tabular data handling toolkit |
fldfmt(1) - take a tabular data stream and format, add new field, or modify a field
SYNOPSISfldfmt [options] [formatstring]DESCRIPTIONfldfmt is a filter utility that selects fields from a stream of records and outputs them to standard output. It can be used to build human-presentable reports, or to process data. Data records should be white-space delimited, tabular ascii format. One output record is produced for every input record. Use it in one of these modes:format mode: Create formatted rows. Fields will be presented as specified in a formatstring argument (or format file when -f is used). This is the default mode. You'll probably want to also use -dp for data processing purposes. new field mode: all fields will be output, along with one new field. See -newfield below
modify field mode: all fields will be output, with one of them changed to a constant value. See -modfield below
FORMAT MODEformatstring (or the format file) may contain data field @names or field @numbers as in the examples below. Inline formatting codes , all of which begin with colon (:) may also be used. Everything else in formatstring is passed through transparently.
formatstring may actually be up to 3 command line arguments,
which fldfmt will concatenate together. This allows long formatstrings
to be split up for readability.
OPTIONS-h
-t
-f formatfile
-dp
-u
-c
-newfield fieldpos# contents
-modfield fieldpos# contents
-l
-s
-bh
EXAMPLEScat mydata | fldfmt "@1 (@2)" cat mydata | fldfmt "@1 @2 :dec28 @4" cat scores | fldfmt -h "Name: @firstname @lastname :col40 Score: @score" cat scores | fldfmt -newfield 3 "=" cat scores | fldfmt -modfield 6 "d" The following example makes html table rows containing hyperlinks. Assumes that CGIPROG is defined to the URL of the CGI executable using varvalue in the tdh config file. fldfmt "<td><a href=\"@CGIPROG?rtn=people/details&id=@id\"> @fname @lname</a></td></tr>" SEE ALSOfldsel(1) , another TDH utility can select and omit fields |
![]() Tabular data handling toolkit Copyright Steve Grubb |