Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Merge two files line-by-line

Status
Not open for further replies.

Josewr

Technical User
Feb 28, 2005
15
US
I have two files that I want to merge. Both have the same number of lines and I want to merge them line by line. The data is tab delimited and may contain floating points as well as Boolean. They may have over 100 lines each; but the files to be merged will always have the same number of lines. All the lines on each file will have the same number of elements.

FileA: Array( R,4)

64.758 34.54 6.1 15.7
65.758 24.33 10.4 3.64
...
75.758 25.4 13.68 12.9

FileB: Array (R, 7)
64.758 1 1 0 12 1 0
65.758 0 1 1 15 0 0
...
75.758 1 0 1 14 1 1

I would like to merge them into FileC: Array (R, 11)

64.758 34.54 6.1 15.7 64.758 1 1 0 12 1 0
65.758 24.33 10.4 3.64 65.758 0 1 1 15 0 0
...
75.758 25.4 13.68 12.9 75.758 1 0 1 14 1 1

I have seen several files on this forum for merging files, but the put one under the other, or merge data if it meets certain criteria. All I want to do is plain merge them
Thanks for your help.

Jose
 
man paste

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
man join

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks, join did the trick.
That shows you how little I know about SUN commands. I have heard of them, but my mind was tuned to AWK or GAWK.

Thanks again.

Josewr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top