Tabular data handling toolkit 


Command Manual page for FLDFMT(TDH)

fldfmt - select fields and output them with formatting



SYNOPSIS

fldfmt options formatstring


DESCRIPTION

fldfmt is a filter utility that selects fields from a stream of records and outputs them to standard output, formatted according to formatstring, once for every input record. Data records should be white-space delimited, tabular ascii format.

formatstring 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.

Another utility can select and omit fields is fldsel(1) .


OPTIONS

-h

Header mode. Data field names are expected in the first non-comment non-blank line, separated by white space. The header is not replicated in the output. Example. Also controlled using the project config file fieldnameheaders attribute.

-h-

Do not expect field name header line in the input.

-r format

Specifies a format ( fdf file ) where field names are defined.

-bh

Output a bogus field name header as the first output line. May be useful in situations where a header line is expected but not used.

-t

Input fields will be tab-delimited. May also be set using project config file tabfields attribute.

-f formatfile

Output format will be taken from formatfile instead of the command line.

-u

Show embedded underscores found in data fields. Normally they are converted to spaces. Underscore conversion may also be controlled within formatstring using inline formatting codes :u+ and :u-.

-c

Show nulls literally. Normally nulls are displayed as a zero length string. Null representation may be controlled from the project config file .

-l

Turn off evaluation of inline formatting codes

-s

Suppress data-less lines. For lines that contain at least one variable, and that had all variables evaluate to "" (nothing), the entire line is suppressed. If format is more than one line, individual lines are handled separately.


EXAMPLES

cat mydata | fmtfld "@1 (@2)"

cat mydata | fmtfld "@1 @2 :dec28 @4"

dbcat scores | fmtfld -r scores "Name: @firstname @lastname :col40 Score: @score"

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.

fmtfld "<td><a href=\"@CGIPROG?rtn=people/details&id=@id\">
   @fname @lname</a></td></tr>"



ENVIRONMENT

TDHKIT_CONFIG

Location of project config file

Other TDHKIT environment variables


Tabular data handling toolkit 
Copyright Steve Grubb


Markup created by unroff 1.0,    August 02, 2001.