There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Linux and Unix
Tag Cloud
access acer asus bios bsod computer crash dns driver drivers error ethernet excel freeze gaming hard drive hardware hdmi internet java laptop mac malware memory monitor motherboard mouse network printer problem ram registry router security server slow software sound trojan usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Operating Systems > Linux and Unix >
sort

Reply  
Thread Tools
mgonzalo's Avatar
Junior Member with 15 posts.
 
Join Date: Apr 2007
Experience: Beginner
05-Jun-2007, 04:12 AM #1
sort
hello, I have a file that has 3 columns and I want to make a numeric sort with third
column in ascending order.

the file of serious departure (file1).
1 TATE DANCER -12
2 STANISLESS 0
3 UN CAPO 7
4 BABIA -3
5 ZAGATO -2
6 ELDAMAR -10
7 ALABARDERO -7
8 DUDU -8.5
9 OCHO REALES 3
10 CARMENTA -2.5
11 ALBARREAL -6
12 ARNOIA -7
13 RIVALLERO -4
14 VAILLANT PRINCE 4
15 TORCAL -4.5
16 CASTROGONZALO -6
17 BEST SUPER -17
18 THE BREAKERS -13
19 KIZAS -2
20 DANS LES ETOILES -22.5



if I make the sort with these parameters it leaves me

sort -r -k 1.29,1.32 file1

3 UN CAPO 7
14 VAILLANT PRINCE 4
9 OCHO REALES 3
2 STANISLESS 0
8 DUDU -8.5
7 ALABARDERO -7
12 ARNOIA -7
16 CASTROGONZALO -6
11 ALBARREAL -6
15 TORCAL -4.5
13 RIVALLERO -4
4 BABIA -3
20 DANS LES ETOILES -22.5
10 CARMENTA -2.5
5 ZAGATO -2
19 KIZAS -2
17 BEST SUPER -17
18 THE BREAKERS -13
1 TATE DANCER -12
6 ELDAMAR -10

but I would want that this came out.

3 UN CAPO 7
14 VAILLANT PRINCE 4
9 OCHO REALES 3
2 STANISLESS 0
5 ZAGATO -2
19 KIZAS -2
10 CARMENTA -2.5
4 BABIA -3
13 RIVALLERO -4
15 TORCAL -4.5
16 CASTROGONZALO -6
11 ALBARREAL -6
7 ALABARDERO -7
12 ARNOIA -7
8 DUDU -8.5
6 ELDAMAR -10
1 TATE DANCER -12
18 THE BREAKERS -13
17 BEST SUPER -17
20 DANS LES ETOILES -22.5

that options should use in the sort?
Squashman's Avatar
Trusted Advisor with 18,703 posts.
 
Join Date: Apr 2003
Location: 1265 Lombardi Ave
Experience: Bocks of Rox
06-Jun-2007, 12:55 AM #2
Did you try -n
mgonzalo's Avatar
Junior Member with 15 posts.
 
Join Date: Apr 2007
Experience: Beginner
06-Jun-2007, 09:26 AM #3
thank, is -nr
Reply

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 08:01 PM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.