sorting in awk | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


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

sorting in awk

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 01-30-2007
mahabunta mahabunta is offline
Registered User
 
Join Date: Aug 2006
Last Activity: 8 July 2008, 8:29 AM EDT
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
Bashar Bashar is offline
Registered User
 
Join Date: Aug 2001
Last Activity: 11 November 2013, 7:16 AM EST
Location: Kuwait
Posts: 74
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  
Advisor
 
Join Date: Mar 2006
Last Activity: 21 November 2014, 4:45 AM EST
Location: Bangalore,India
Posts: 2,091
Thanks: 12
Thanked 131 Times in 126 Posts

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

    #4  
Old 01-31-2007
Krrishv Krrishv is offline
Registered User
 
Join Date: Dec 2006
Last Activity: 20 August 2014, 1:58 AM EDT
Location: CA,United States
Posts: 204
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 10:59 AM
Sorting - Reg. ecearund Shell Programming and Scripting 8 04-23-2010 06:34 PM
Sorting help nirnir26 UNIX for Dummies Questions & Answers 1 11-09-2009 10:04 AM
Regarding sorting vivek.bharadwaj Shell Programming and Scripting 6 02-06-2009 02:59 AM
Sorting : satyam_sat Shell Programming and Scripting 3 04-15-2008 01:30 PM



All times are GMT -4. The time now is 04:41 PM.