Prints selected parts of lines (of a text file), or, in other words, removes
certain sections of a line. You may wish to remove things according to tabs or
commas, or anything else you can think of...
Options for cut:
-d # allows you to specify another delimiter
cut -d ':' /etc/passwd
-f # columns, separated by delimiter
cut -d ',' -f 1 /etc/passwd
, # separate numbers, used to cut particular columns.
cut -d ':' -f 1,7 /etc/passwd
- # from line x to line y
cut -c 1-50 file1.txt
-x # cut from line 1 to “x”
x- # cut from “x” to the end.
cut -5, 20-, 8 file2.txt
Version
1, updated 531 days ago.
. o 0 (
edit |
history )