Esteemed Monks I humbly ask for your assistance,
In searching a flat text file I want to exclude certain rows from processing and copy these lines into my output file. I am successful when a line starts with a “2” as in this example:
if ( $line !~ m/^2/ ) {
I want to be able to do a similar thing when a group of 3 characters is found in positions 14-16, apply certain changes to line before writing it to the output file. My guess is that I would use an if ... then ... else statement and start the logic with something like this:
if ( $line, 14 !~ m/^801/ ) {
I would then define the processing parameters for this match and if no match then the row would be processed as usual.
Any help and advice would be appreciated.
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.