cut command

The cut command is used to display only specific columns or characters from a text file or from other command outputs. For example, in the following command, we display the login names from the /etc/passwd file:

$ cut -d: -f1 /etc/passwd

Output upon execution of the preceding command is shown in the following screenshot:

The following command line displays the first and third fields from a colon-delimited file (extra lines stripped from output):

$ cut -d: -f1,3 /etc/passwd

Output upon execution of the preceding command is shown in the following screenshot:

The following command line display only the first four characters of every line in the /etc/passwd file:

$ cut -c 1-4 /etc/passwd
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.217.8.82