Monday, August 07, 2006

[Some Thinks about everything] Linux:: Presentation of the command SORT

You want to write some shell script, this link should teach you everything you should know

Let me introduce you to a fabulous tool: sort. Just an example of marvelous things you can do by using it:
Let be the file techno.txt


1 £.34 Adnan Hajj
2 £.45 Wwdc
3 £.35 Reuters
4 £.10 Lebanon
5 £.500 Apple
6 £.39 Aol Data
7 £.1 Mel Gibson
8 £.1000 Israel
9 £.27 Video
10 £.3 Intimations of Recession
11 £.67 Lollapalooza
12 £.345 Erik
13 £.675 Wordcamp
14 £.876 Flavor of Love
15 £.56 Joe Francis


Sort price:

$ sort -n -t. -k2 techno.txt


7 £.1 Mel Gibson
10 £.3 Intimations of Recession
4 £.10 Lebanon
9 £.27 Video
1 £.34 Adnan Hajj
3 £.35 Reuters
6 £.39 Aol Data
2 £.45 Wwdc
15 £.56 Joe Francis
11 £.67 Lollapalooza
12 £.345 Erik
5 £.500 Apple
13 £.675 Wordcamp
14 £.876 Flavor of Love
8 £.1000 Israel

Now a quick explaination of the syntax:

-n numerical
-t. separator: the dot
-k key

It's enough for today, play with it create your own files, if you have a problem let me know I will be glad to help you

--
Posted by ServalX02 to Some Thinks about everything at 8/07/2006 09:11:00 PM

No comments: