Unix/Linux Go Back    


Shell Programming and Scripting Unix shell scripting - KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and shell scripts and shell scripting languages here.

sorting in awk

Shell Programming and Scripting


Closed Linux or Unix Question    
 
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: 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 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: 16 March 2015, 4:56 AM EDT
Location: Bangalore,India
Posts: 2,136
Thanks: 14
Thanked 150 Times in 143 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: 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 Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Unix or Linux Image 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 01:34 AM.