[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.1 cut: Print selected parts of lines

cut writes to standard output selected parts of each line of each input file, or standard input if no files are given or for a file name of `-'. Synopsis:

 
cut [option]... [file]...

In the table which follows, the byte-list, character-list, and field-list are one or more numbers or ranges (two numbers separated by a dash) separated by commas. Bytes, characters, and fields are numbered starting at 1. Incomplete ranges may be given: `-m' means `1-m'; `n-' means `n' through end of line or last field. The list elements can be repeated, can overlap, and can be specified in any order; but the selected input is written in the same order that it is read, and is written exactly once.

The program accepts the following options. Also see 2. Common options.

`-b byte-list'
`--bytes=byte-list'
Print only the bytes in positions listed in byte-list. Tabs and backspaces are treated like any other character; they take up 1 byte.

`-c character-list'
`--characters=character-list'
Print only characters in positions listed in character-list. The same as `-b' for now, but internationalization will change that. Tabs and backspaces are treated like any other character; they take up 1 character.

`-f field-list'
`--fields=field-list'
Print only the fields listed in field-list. Fields are separated by a TAB character by default. Also print any line that contains no delimiter character, unless the `--only-delimited' (`-s') option is specified

`-d input_delim_byte'
`--delimiter=input_delim_byte'
For `-f', fields are separated in the input by the first character in input_delim_byte (default is TAB).

`-n'
Do not split multi-byte characters (no-op for now).

`-s'
`--only-delimited'
For `-f', do not print lines that do not contain the field separator character. Normally, any line without a field separator is printed verbatim.

`--output-delimiter=output_delim_string'
For `-f', output fields are separated by output_delim_string. The default is to use the input delimiter.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by Jeff Bailey on December, 28 2002 using texi2html