[NTLUG:Discuss] Linux sort

Fred James fredjame at fredjame.cnc.net
Mon Apr 21 00:56:27 CDT 2008


Leroy Tennison wrote:

>How do you sort a tab-delimited file using sort?  Created the following 
>test file (named test):
>
>five    zzzzz   5
>Four    vcxvbc  3
>one     asdf    4
>three   ghjks   1
>Two     qwerty  2
>
>(those are tabs separating the text, I checked with hexdump)
>
>
>I've tried
>
>sort -t\t -k3,3 test
>sort -t\t -k3n,3 test
>sort -t '9' -k3,3 test
>sort -t '\9' -k3,3 test	(Produces a "multi-byte tab" error message)
>  
>
Leroy Tennison
sort -k3
A tab is a white space - hope that helps
Regards
Fred James



More information about the Discuss mailing list