The cut command is used to extract specified columns/characters of a piece of text, which is given as follows:
- -c: Specifies the filtering of characters
- -d: Specifies the delimiter for fields
- -f: Specifies the field number
The following are a few examples that show the usage of the cut command:
- Using the next command, from the /etc/passwd file, fields 1 and 3 will be displayed. The display will contain the login name and user ID. We use the -d: option to specify that the field or columns are separated by a colon (:):
$ cut -d: -f1,3 /etc/passwd
- Using this command, from the /etc/passwd file, the fields 1 to 5 will be displayed. ...