Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I want to use cut command to break input into fields and get the second field. cut -f2 -d' ' <--- How can I tell it to use tab instead of space

share|improve this question
Using cut with unprintable delimiters (stackoverflow) –  nobar Nov 21 '14 at 20:14

4 Answers 4

up vote 55 down vote accepted

Two ways:

Press Ctrl-v + Tab

cut -f2 -d'   ' infile

or write it like this:

cut -f2 -d$'\t' infile
share|improve this answer
$'' — bash'ism, AFAIR –  poige Mar 30 '12 at 11:45
Neither works in Windows (e.g., Git Bash) obviously. Use @Mikel's answer there (default delimiter is tab, simply omit -d argument). –  Ahmed Fasih Nov 4 '14 at 14:40

Tab is the default.

See the cut man page.

-d delim
         Use delim as the field delimiter character instead of the tab

So you should just write

cut -f 2
share|improve this answer
Oops didn't notice that line. –  Hasan Khan Mar 30 '12 at 15:54

awk '{ print $2; }' inputfile

share|improve this answer
That will fail if $1 contains spaces. Specify the field separator. –  manatwork Mar 30 '12 at 11:32
If you wish to preserve other whitespace than \t, then it will fail. Otherwise not. –  ipip Mar 30 '12 at 12:07
@ipip The question specifically mentions tabs instead of spaces. –  Burhan Ali Mar 30 '12 at 13:04

More generically, without requiring any invisible characters: Use tr to convert the delimiters to a format that can be specified more easily to cut.

$ echo -e "a\tb\tc" |tr '\t' ' ' |cut -d' ' -f2

tr is a simple, but powerful, character matching and replacement tool.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.