Re: [Nolug] question about sort(1)

From: Ron Johnson <ron.l.johnson_at_cox.net>
Date: Tue, 09 Mar 2004 14:05:22 -0600
Message-Id: <1078862721.2466.33.camel@haggis.homelan>

On Tue, 2004-03-09 at 13:39, Mark A. Hershberger wrote:
> Ron Johnson <ron.l.johnson@cox.net> writes:
>
> > Why is sort(1) trying to be so clever?
>
> It isn't being clever. It's being stupid.

I said it was *trying* to be clever, not *succeeding*! ;)

> What you need to do is tell it which field to sort on. Right now, it
> just sees the first field and does an alphabetical sort. Even if you
> tell it "-n", it'll still do an alphabetical sort since the first
> non-whitespace character of each line is "f".

Still, why is it compressing the whitespace?

> So, tell it to sort on the second field using a numeric sort.:
>
> $ sort -k 2 -n your-file.txt
> file 50 10-15 19:05 ./GovForum2_2003.ram
[snip]

It works!! Woo hoo!! Thanks.

$ sort -k 2 -n download/file.lst
file 50 10-15 19:05 ./GovForum2_2003.ram
file 493 01-20 18:45 ./MD5SUMS
file 5,454 03-01 12:03 ./HP-LaserJet_1100-hpijs.ppd.gz
file 14,236 08-25 04:55 ./Analysis of Asteroid Split.pdf
file 30,227 07-26 17:07 ./EasyTables0.8.4-9.tar.bz2
file 195,294 01-18 22:09 ./FAQ_Rev05_ENG.pdf
file 203,680 05-08 15:56 ./LinuxCompilersCompatibility702.pdf
file 651,283 07-26 14:57 ./Browser282b2.tar.gz
file 3,387,062 02-21 16:56 ./24547010.pdf

-- 
-----------------------------------------------------------------
Ron Johnson, Jr. ron.l.johnson@cox.net
Jefferson, LA USA
"What's your genius, perfect 20 years too late Monday morning
quarterback answer to how the US should have responded to the
Soviet invasion of Afghanistan? Oh wait, you're just talking crap
- you don't have a real answer, you're just regurgitating crap
from NPR."
http://slashdot.org/comments.pl?sid=76597&cid=6839483
___________________
Nolug mailing list
nolug@nolug.org
Received on 03/09/04

This archive was generated by hypermail 2.2.0 : 12/19/08 EST