Hi,
What would be an efficient way to substitute lines of text
when portion of it matches with part of the text from another file?
Say I have the 2 files as follows -
file 1:
123|abc|777
234|cde|456
567|xyz|999
file 2:
789|efg|2222222
123|abc|9999999
786|uvw|1234567
123|xxx|0000000
234|cde|0000000
567|xyz|1111111
After processing file 2 using file 1 the output of it should be -
789|efg|2222222|NO MATCH
123|abc|9999999|777
786|uvw|1234567|NO MATCH
123|xxx|0000000|NO MATCH
234|cde|0000000|456
567|xyz|1111111|999
File 2 is quite a large file and file 1 has about 2000
lines
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.