Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!mips!pacbell.com!pacbell!ptsfa!dmturne From: dmturne@PacBell.COM (Dave Turner) Newsgroups: comp.unix.questions Subject: Re: sort first two fields in numeric order Keywords: this shouldn't be difficult Message-ID: <6189@ptsfa.PacBell.COM> Date: 19 Jun 91 22:36:50 GMT References: <1991Jun18.222520.7816@drd.com> Reply-To: dmturne@PacBell.COM (Dave Turner) Distribution: na Organization: Pacific * Bell, San Ramon, CA Lines: 27 In article felps@convex.com (Robert Felps) writes: .In <1991Jun18.222520.7816@drd.com> mark@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