[NTLUG:Discuss] Linux sort

Rusty Haddock rusty at fe2o3.lonestar.org
Mon Apr 21 01:15:44 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
    >
    >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)

sort -t "^V^I" -k3,3n test
	or
sort -t "^V^I" -k3,3 -n test

The ctrl-V ctrl-I sequence may be different for your shell
but put a literal TAB between two of the same type quote marks.

	-Rusty-
-- 
   _____                Rusty Haddock  <=>  AE5AE
|\/   o \   o             Way out yonder in the
|   (  -<  O o      Van Alstyne (TX) Metropolitan Area
|/\__V__/       Math illiteracy affects 7 out of 5 people!



More information about the Discuss mailing list