merge two files in one file

All,

I've basic knowlege on understanding UNIX Shell Programming. Right now I need to write a script for the following requirement. Kindly help me or suggest me how to write a Shell script.

I've 8 .csv files that are containing "Detail" records. Each file getting more than 1 million. Another eight files (.csv) are containing only one "Header" in each file. Now I want to MERGE these <Header> and <Detail> records in one file in the below format:

tstVenkat1.csv
This is Header Record
This is Detail Record
This is Detail Record
.
.
.
.
tstVenkat8.csv
This is Header Record
This is Detail Record
This is Detail Record

For <Header> record the file naming convention as tst1Venkat.xml and for <Detail> records the file naming convention as tstVenkat1.xml

From the above, want to send tst1Venkat.xml (ie., Detail records) to tstVenkat1.xml (ie., Header record containing here and it must be the first line in this file).

Kindly help to write in a shell script.

Thank you!

  • Venkat

either i didnt got ur problem rite or it doesnt need any script

try this

cat testvenkat1.xml >> test1veknat.xml

Please provide more examples.

here is the code to concat the files:

 cat file1 file2 file3 >> Outputfile

cat <<header file>> <<detail file>> > <<new file>>