cut (Unix)

Cut is a Unix command for column-wise extraction of text line by line eingelesenem.

Line segments can be byte (- b ), characters (- c ) or as fields (-f ) are extracted, by means -d delimiter can be specified. For range specifications, the options N, NM, N- (N to end of line ), or- M are ( beginning of the line to M) are available.


A file a.tst contains the following lines:

Foo: bar: baz: qux: quux   one: two: three: four: five: six: seven   alpha: beta: gamma: delta: epsilon: zeta: eta: teta: iota: kappa: lambda: mu with

% Cut- c 4-10 a.tst then can be, for example, the 4th - 10th Character of each line output:

: bar: ba  : two: th   ha: beta during

% Cut-d :-f 5 - a.tst from the fifth field of the remaining content of each line, separated by colons, outputs:

Quux   five: six: seven   epsilon: zeta: eta: teta: iota: kappa: lambda: mu. see also

  • Grep