cut
noun
say it: “KUT” /kʌt/
A command that keeps only the columns or characters of each line you ask for.
What does cut do?
cut keeps only the parts of each line you ask for. -d names the delimiter that splits a line into columns and -f picks the columns by number (-f3,5 for the third and fifth); -c picks characters by position instead (-c1-7). Without -d it splits at tabs.
cut -d, -f4 orders.csv | head -n 2
# email
# zoe.hart@example.com
In a sentence
- “Sam used cut -c1-7 to keep the year and month from each date.”
- “cut -d, -f4 orders.csv printed only the email column.”
Level: Apprentice · More Unix terms at this level
Updated