The UNIX and Linux Forums  

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 02-07-2007
sb008 sb008 is offline Forum Advisor  
Registered User
  
 

Join Date: Jan 2007
Posts: 384
I'm sure the real (n)awk experts have a better solution.

nawk '/^Name[ ]*:/ { NAM=$0 }; /^Address[ ]*:/ { ADDR=$0 }; /^City[ ]*:/ { print NAM"|"ADDR"|"$0 }' file1.txt | paste -d"|" - file2.txt | nawk '{ FS="|" } { print $1; print $4; print $3 }'