cut—removes selected fields or characters from each line of a file

cut {-b byte-list, --bytes=byte-list} [-n][--help][--version] [file…]
cut {-c character-list, --characters=character-list}[--help] [--version]
    [file…]
cut {-f  field-list, --fields=field-list} [-d delim][-s][--delimiter=delim]
    [--only-delimited] [--help][--version] [file…]

The cut command cuts out columns or characters from a line of a file and if no files are given, uses standard input. The -d option specifies the field delimiter. The default delimiter is a tab.

Example A.17.
1  cut --help
2  cut -d: -f1,3 /etc/passwd
3  cut -d: -f1-5 /etc/passwd
4  cut -c1-3,8-12 /etc/passwd
5  date | cut -c1-3
				

Explanation

  1. The help option displays information about options and arguments to ...

Get Linux Shells by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.