Hi everyone, I'm new to Perl and new to this site too, so don't mind my silly question. I've a problem: There's two huge files (one is 37 MB, another is 5 MB), now all I have to do is, take a substring of each line from the big file, compare with a substring of all the lines in the small file, and whenever there's a match, the whole line of the big file appended with the some portion of the matching line from the small file goes to a separate file, say file1. If there isn't any match, the line goes to another file, say file2. Now using simpler and straight ways, I got this working, but the time took around 22-30 minutes. While an equivalent shell+awk+sed script took around 15 minutes. Now, I can't run the shell script in Windows, I got to do the stuff in Perl, so my question is: is there any way (or trick may be) by which I can decrease the total processing time considerably? And one more thing, its best if I could do this with the standard libraries that come with Perl, as installing extra ones on a restricted network could be a problem. Please help!
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.