www.delorie.com/gnu/docs/textutils/coreutils_40.html   search  
Buy GNU books!

GNU Core-utils

[ < ] [ > ]   [ << ] [ 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'
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'
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'
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'
For `-f', fields are separated in the input by the first character in input_delim_byte (default is TAB).

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

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

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

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

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003