Unix/Linux Go Back    


Shell Programming and Scripting BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

sorting in awk

Shell Programming and Scripting


Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 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 Unix and Linux 01-30-2007
Bashar Bashar is offline
Registered User
 
Join Date: Aug 2001
Last Activity: 7 July 2016, 6:06 PM EDT
Location: Kuwait
Posts: 74
Thanks: 0
Thanked 1 Time in 1 Post
pipe it to |sort -n
Sponsored Links
    #3  
Old Unix and Linux 01-31-2007
anbu23's Unix or Linux Image
anbu23 anbu23 is offline Forum Advisor  
Advisor
 
Join Date: Mar 2006
Last Activity: 7 November 2016, 6:31 AM EST
Location: Bangalore,India
Posts: 2,152
Thanks: 21
Thanked 159 Times in 150 Posts

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

    #4  
Old Unix and Linux 01-31-2007
Krrishv Krrishv is offline
Registered User
 
Join Date: Dec 2006
Last Activity: 24 December 2015, 4:32 PM EST
Location: CA,United States
Posts: 204
Thanks: 1
Thanked 0 Times in 0 Posts
sort -nt "~" -k1,k5 file
Sponsored Links
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux 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:28 AM.