Greetings,
I need to perform a search and replace in a file that has delimiters START and END.
START and END could be on separate lines or the same line.
In addition, if the pattern between START and END has a word with a \ in front of it, for e.g,
START This is the line I need to \change END
then the search and replace do not apply to \change.
Let me provide an example. Let the name of the file be filein, which contains -
I am IntErEsted in making changes to the following lines.
However, START thE chAnges mUst bE \CME madE hErE. END
There may be cases whErE
START chAngEs nEEd to be mAdE hErE
tOO. END
In the above paragraph, I need to do a search and replace in between START and END.
What I am looking for is
I am IntErEsted in making changes to the following lines.
However, START the changes must be \CME made here. END
There may be cases whErE
START changes need to be made here
too. END
Thank you in advance for your help.
eskay
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.