[Linux-users] Sort Question

tom marinis tmarinis99
Thu Aug 2 14:01:55 PDT 2007


I think is fairly simple problem but I simply can't get my head 
around it.  I guess my brain needs to go in for some warranty 
work :)

Maybe someone here can point me to a newgroup for further tips
or make a helpful suggestion?

Here it is.

I have a listing of number in a textfile, lets say something
like this;

less sourcefile.txt

3:51:12:74:41:43:13
8:33:36:37:39:41:9
1:6:23:24:27:39:34

etc...


My thinking is to use "sort", using the numeric option.

Reading the man instructions, they say that I can use 
options -gn, but -g or -n  simply does the same thing.
When I try to "sort" the textfile, I get something 
like this;

$ sort -t: -g inputfile.txt > outputfile.txt

1:6:23:24:27:39:34
3:51:12:74:41:43:13
8:33:36:37:39:41:9

Which is nice, but what the results I expected to 
generate are something different.  I need to sort by 
field as well, so what I want to see from output 
is something like this;

1:6:23:24:27:34:39
3:12:13:41:43:51:74
8:9:33:36:37:39:41


Do I use something else other than sort, or have I missed
something about sort that's very obvious?

I'm trying to review the archives, but I don't have a 
clue where to find this topic mentioned anywhere.

Thanks muchly...

Tom.


       
____________________________________________________________________________________
Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online.
http://smallbusiness.yahoo.com/webhosting 



More information about the Linux-users mailing list