Documentation ¶
Overview ¶
The `field` command reads newline-separated lines of data from either the standard input or the specified files. It splits those lines into a list of fields, separated by a specifiable regular expression. It then prints all or a subset of those fields to the standard output.
The list of output fields is specified using a grammar given in the parsing code, below.
Options '-F' and '-O' control the input and output separators, respectively. The NUL character can be used as an output separator if the '-0' is given. The '-e' and '-E' characters contol whether empty fields are collapsed in the input; '-e' unconditionally preserves such fields, '-E' discards them. If neither is specified, a heuristic is applied to guess: if the input specifier is more than one character in length, we discard empty fields, otherwise we preserve them.