Hi All,
I am a new bie for perl and perl monks.. I had gone through many posts of perl monks but could not find the answer for a problem which i m having.
I have a task of merging columns of multiple files(tab seperated) based on multiple common columns. e.g.
File1.txt
ID NAME date Val1 Val2 Val3 Val4
1 ABC 04-05-2013 10 11 12 13
2 XYZ 04-05-2013 21 22 23 24
1 ABC 05-05-2013 30 31 32 33
2 XYZ 05-05-2013 41 42 43 44
File2.txt
ID NAME date Val101 Val102 Val103 Val104
1 ABC 04-05-2013 50 51 52 53
File3.txt
ID NAME date Val101 Val102 Val103 Val104
1 ABC 05-05-2013 60 61 62 63
2 XYZ 05-05-2013 71 72 73 74
All these files should merge as below
result.txt
ID NAME date Val1 Val2 Val3 Val4 Val101 Val102 Val103 Val104
1 ABC 04-05-2013 10 11 12 13 50 51 52 53
2 XYZ 04-05-2013 21 22 23 24 "--" "--" "--" "--"
1 ABC 05-05-2013 30 31 32 33 60 61 62 63
2 XYZ 05-05-2013 41 42 43 44 71 72 73 74
The Data Files cand have rows in few thousands
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.