Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 01-30-2007
Registered User
 
Join Date: Aug 2006
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
sorting in awk

i have following file have following type of data

1~%%~fcashfafh~%%~9797

can i sort(numeric) the file on first field and then on last feild using awk
Sponsored Links
    #2  
Old 01-30-2007
Registered User
 
Join Date: Aug 2001
Posts: 67
Thanks: 0
Thanked 1 Time in 1 Post
pipe it to |sort -n
Sponsored Links
    #3  
Old 01-31-2007
anbu23's Avatar
anbu23 anbu23 is offline Forum Advisor  
Registered User
 
Join Date: Mar 2006
Location: Bangalore,India
Posts: 1,952
Thanks: 6
Thanked 79 Times in 77 Posts

Code:
sort -t"~" -kn1 -kn5 file

    #4  
Old 01-31-2007
Registered User
 
Join Date: Dec 2006
Location: CA,United States
Posts: 199
Thanks: 1
Thanked 0 Times in 0 Posts
sort -nt "~" -k1,k5 file
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
sorting help sam127 Shell Programming and Scripting 6 08-31-2010 09:59 AM
Sorting - Reg. ecearund Shell Programming and Scripting 8 04-23-2010 05:34 PM
Sorting help nirnir26 UNIX for Dummies Questions & Answers 1 11-09-2009 09:04 AM
Regarding sorting vivek.bharadwaj Shell Programming and Scripting 6 02-06-2009 01:59 AM
Sorting : satyam_sat Shell Programming and Scripting 3 04-15-2008 12:30 PM



All times are GMT -4. The time now is 09:48 AM.