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.

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
add comment

migrated from stackoverflow.com Aug 27 '12 at 16:11

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

2 Answers

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

"`t"
share|improve this answer
add comment

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
add comment

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.