Bash Cut Command Show the first column of a file


Suppose you have a file that looks like this

John Smith 31
Robert Jones 27

This file has 3 columns separated by spaces. To select only the first column, do the following.

cut -d ' ' -f1 filename

Here the -d flag, specifies the delimiter, or what separates the records. The -f flag specifies the field or column number. This will display the following output