Merge 2 files

Hi ,

This might be the stupidest question I am asking, but I am struck with this problem. I am trying to merge 2 files, file1 has header and file2 has contents. while I merge them , it merges from the 1st line of file1.

for ex: file1

col1|col2|col3|

file2

123|234|456|
456|ert|hkl|

when I tried

cat file1 file2 > file3

and

cat file2 >> file1

etc ..but nothing worked.

the output comesline this

col1|col2|col3|123|234|456|
456|ert|hkl|

I want my ouput to be

col1|col2|col3|
123|234|456|
456|ert|hkl|

I am working on sun os.

Thanks
Rashmi

Add newline at the end of file1 before joining. You can do this like this:

echo -e "\n" >> file1
cat file1 file2 > file3

If file1 contains some ^M stuff

dos2unix file1 file1
cat file2 >>file1