info
-
remove or
cut outsections of each line of a file or files -
when invoking
cutuse -b -c or -f option, but only one of them
demo
-
cut field
-
second-through-fourthfield of each line$ cut -f 2-4 data.txt -
first-through-secondandfourch-through-fifthfield$ cut -f 1-2,4-5 data.txt -
third and every field after it
$ cut -f 3- data.txt
-
-
specifying a delimiter other than tab
-
cut by
:$ cut -f 1 -d ':' data.txt -
delimited by a space
$ cut -f 1,3 -d ':' --output-delimiter=' ' data.txt -
delimited by
tab$ cut -f 1,3 -d ':' --output-delimiter=$'\t' data.txt
-
-
character
-
output third character
$ cut -c 3 data.txt -
output first three characters
$ cut -c 1,3 data.txt
-