sort first two fields in numeric order

Dave Turner dmturne at PacBell.COM
Thu Jun 20 08:36:50 AEST 1991


In article <felps.677332177 at convex.convex.com> felps at convex.com (Robert Felps) writes:
.In <1991Jun18.222520.7816 at drd.com> mark at drd.com (Mark Lawrence) writes:
.
.>I've got a file with tab separated columns of stuff that I
.>expand to pretty tabstops and sort.  I want to sort the file 
.>primarily on the first column and then on the second, both
.>numerically.  No problem, right?
.
.>expand -5 foo | sort +0n -1n 
.
.>should treat both the first and second columns as numerics
.>and sort them in that order.  It don't.  I get:
.

Don't expand the tabstops to spaces before you sort.

On SVR[23] the following works.

	sort -n -t"	" +0 -1 +1 -2 foo

Note that there is a real tabcharacter between the ""s in the -t option. 
The ""s are needed to tell sh that the TAB is not whitespace on the command line
and that it should be passed to sort as an argument.


-- 
Dave Turner	415/823-2001	{att,bellcore,sun,ames,decwrl}!pacbell!dmturne



More information about the Comp.unix.questions mailing list