The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 06-09-2008
radoulov's Avatar
radoulov radoulov is offline Forum Staff  
addict
  
 

Join Date: Jan 2007
Location: Варна, България / Milano, Italia
Posts: 2,854
If the order is not important:

(use nawk or /usr/xpg4/bin/awk on Solaris)

Code:
awk 'END{for(k in _)print _[k]}{_[$NF]=$0}' file1 file2
Otherwise, given your example:

Code:
awk 'END{for(k in _)print _[k]}{_[$NF]=$0}' file1 file2 |
  sort -k3n

Last edited by radoulov; 06-09-2008 at 09:39 AM..