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 -->
  #1 (permalink)  
Old 04-21-2009
skumre skumre is offline
Registered User
  
 

Join Date: Apr 2009
Posts: 2
how to merge selective content between files using awk?

Hello,

I'm new to awk. I've 2 files where H stands for header and T for trailer. The number following T gives the record count in a file.

file 1 looks like this:
H|A|B|C
1|2|3
1|2|4
2|3|5
T|3

file 2 looks like this:
H|A|B|C
4|5|6
7|8|9
T|2

Need to merge the above 2 files such that the new file looks like this:

H|A|B|C
1|2|3
1|2|4
2|3|5
4|5|6
7|8|9
T|5

Any help is greatly appreciated.