[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [OT] question regarding sort(1)



On 26 January 2003 at 10:37,
Ron Johnson <ron.l.johnson@cox.net> wrote:

> What I want, though, is a straight, dumb ASCII sort based on each whole
> line of text, where " " collates before "0", etc.  I've looked in the
> man page, but see nothing.

I guess I'm not quite clear on what you want, but as I see it there's 
only two ways to do this:

quail (sjuranic)$ cat text
1
1001
1000
100
10
200
2
19
427
quail (sjuranic)$ cat text
1
1001
1000
100
10
200
2
19
427
quail (sjuranic)$ sort text
1
10
100
1000
1001
19
2
200
427
quail (sjuranic)$ sort -n text
1
2
10
19
100
200
427
1000
1001

Unless you want something really strange, like "2" to come before "200" 
but after "1000" (in which case you'll probably have to roll your own).

----------------------------------------------------------------------
Stephen W. Juranich                         sjuranic@ee.washington.edu
Electrical Engineering         http://students.washington.edu/sjuranic
University of Washington            http://ssli.ee.washington.edu/ssli




Reply to: