Hi all,
Sorry if this question is too easy or basic, but I'm new using Perl and I'm under much pressure to find an answer. I usually would use Stata or SAS for this, but I don't have either of them available right now so my hope is Perl...
I have two data sets:
d1.dat:
v1 v2 v3
880 670 xx
860 670 xx
870 320 xx
890 320 xx
d2.dat:
t1 t2 t3
880 670 yy
860 670 yy
555 667 yy
555 668 yy
What I need is: I need to add a third fourth column to the first data set, which is taken from the second one. So, the
value of v1 and v2 is equal to the value of t1 and t2, I need to add the column t3 to d1.dat. The result should be:
v1 v2 v3 t3
880 670 xx yy
860 670 xx yy
I tried to use awk as well, but it's too slow (both files are about 500 MB...)
Thanks so much!
Mark.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.