Unix 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

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

Leave a Reply