The cut command
remove sections from each line of files 8 examples from the lessons of the IVski Linux Playground — try them in the terminal next to them.
Options in the examples
-f, --fields=LIST- select only these fields; also print any line that contains no delimiter character, unless the -s option is specified
Examples
cat /etc/passwd | cut -d: -f1 | sort | head -10
cut -d: -f1 /etc/passwdField 1, delimiter :
cut -d: -f1,3 /etc/passwdFields 1 and 3
cut -d, -f2 data.csvCSV second column
cut -c1-10 file.txtCharacters 1-10
cut -c5- file.txtFrom character 5 to end
cut -d: -f7 /etc/passwd | sort | uniq -c
cut -d, -f1 data.csv | tr 'a-z' 'A-Z'