tariqahsan has asked for the wisdom of the Perl Monks concerning the following question:
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Substitute text string in a file with matching text from another file
by ikegami (Patriarch) on Aug 12, 2005 at 15:25 UTC | |
|
Re: Substitute text string in a file with matching text from another file
by sh1tn (Priest) on Aug 12, 2005 at 15:56 UTC | |
|
Re: Substitute text string in a file with matching text from another file
by davidrw (Prior) on Aug 12, 2005 at 15:40 UTC | |
|
Re: Substitute text string in a file with matching text from another file
by jch341277 (Sexton) on Aug 12, 2005 at 15:46 UTC | |
|
Re: Substitute text string in a file with matching text from another file
by Transient (Hermit) on Aug 12, 2005 at 15:47 UTC |