Unix/Linux Cut Command

The cut command in unix lets you specify which part of a line you want to echo. For example if
cat file.txt
produces something like:

12345678
23456789
34567890

Cut can also be used to specify particular columns in tab, space or other delimited data.

then you could pipe the file into the cut command to show only the 3rd character like this:


cat file.txt | cut -c 3
3
4
5

You can also specify ranges like this:

cat file.txt | cut -c 3-4,6-8
34678
45789
56890

About 

Leave a Reply

Your email address will not be published. Required fields are marked *