Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

gawk -F\t works, but when it comes to sort, it fails. Under Linux or Cygwin, $'\t' will do it. However, to input a special key Tab, no way. Can anybody figure out a way?

share|improve this question

migrated from Aug 27 '12 at 16:11

This question came from our site for professional and enthusiast programmers.

In PowerShell, the escape character is `. A string containing a tab can be written as

share|improve this answer

Thanks to fellows from Yahoo, Baidu and Stack Overflow, this tough problem is finally solved.

sort -t":" -k1 /var/log/accessfile

This statement give me a hint.

Now the answer is a combination of all tips.

  1. cmd /f:off
  2. sort -t"  "  -k16 foobar.txt 

    (the tab character is in double quotes)

foobar.txt is a text file with the tab separation.

The key is the double quotes ("").

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.