Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

For example, I wanted to use the sort utility with the -t option to specify tab separators, but

sort -t "\t"

doesn't work.

share|improve this question

2 Answers 2

up vote 18 down vote accepted

Don't use double quotes.

sort -t $'\t'

Or I think Ctrl V inserts a Tab??

Edit:

http://www.gnu.org/s/bash/manual/html_node/ANSI_002dC-Quoting.html#ANSI_002dC-Quoting

share|improve this answer
    
Doesn't tab insert a tab? –  RedGrittyBrick Nov 28 '11 at 16:32
    
@RedGrittyBrick Tab completes. –  Daniel Beck Nov 28 '11 at 16:48
2  
Control-V alone won't work; Control-V + Tab will. I like the $'...' trick, though; now I've learned something new. :-) –  L2G Nov 28 '11 at 17:04
    
I've always learned it as $' '. It allows you to enter a string, but also have escaped characters. Double quoting literally prints \t If you leave off the quotes you get a tab character. –  surfasb Nov 28 '11 at 17:09

Try Control-V, then tab. If you see "^I" the cursor tab over to the right, it worked.

share|improve this answer
    
When I do this, I get a real tab (i.e. indentation). –  Daniel Beck Nov 28 '11 at 16:49
2  
Oops. You're right. But it is entering the tab character, not doing command-line completion (which is what bash normally does with a tab). I tried sort -t " " (with the literal tab as described above) and it worked for me. –  L2G Nov 28 '11 at 16:57
    
Yep, that's what I meant by indentation. Didn't know a better term. –  Daniel Beck Nov 28 '11 at 17:13
    
Ctrl-v, Ctrl-i will also work (I found this answer here). Also, I think a Ctrl-q, Ctrl-v, Tab will work. Thanks L2G! –  Mark Nov 28 '11 at 17:20
    
BTW, I would love to accept both answers, but since I think surfasb's solution is more readable, I accepted hers. I like yours, too, though, so voted it up. Thanks! –  Mark Nov 28 '11 at 17:23

Your Answer

 
discard

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.