The source file I'm working on is ~20,000 lines or so and all the source files will be about the same size. There is a "junk file" text file which contains strings that need to be removed from the source file. Each "junk" string is on it's own line and there will be quite a few of these (over 40 different strings of junk).
Example of the junk file which contains phrases that have to be removed from the source file
First Appeared in the Akron Beacon Journal (Ohio)
Email to friend
Get a Map | Get Directions
There will be dozens more than this but these three lines have to be slurped and removed from another text file. The main issue here is speed because if this junk file contains 40+ different strings and it has to remove as many occurences as it can for each of these in a 20k line file, it could take a while, right?
In short, I need to read from junk.txt and be able to use each line as a new substitution to remove them from source.txt
Thank you wise monks.
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.