Hi,
Sorry if I am asking a dumb question....I am new to Perl.
I have a file containing the following:
HEADER(
LIBDAT("GTASK")
VENDOR("DeltaQ")
Environment("zeronom")
TASK_VERSION("5.2")
GENRE_BY("dumpTc")
)
...
...
HEADER(
LIBDAT("GTASK")
VENDOR("DeltaQ")
Environment("zeronom")
TASK_VERSION("5.2")
GENERATED_BY("dumpTc")
)
...
...
HEADER(
LIBDAT("GTASK")
VENDOR("DeltaQ")
Environment("zeronom")
TASK_VERSION("5.2.1")
GENRE_BY("dumpTc")
)
...
...
I want to capture any part of the text that has the following exact sequence of lines- anywhere it occurs in the ascii file I have:
HEADER(
LIBDAT("GTASK")
VENDOR("DeltaQ")
Environment("zeronom")
TASK_VERSION("5.2")
GENRE_BY("dumpTc")
)
Or
HEADER(
LIBDAT("GTASK")
VENDOR("DeltaQ")
Environment("zeronom")
TASK_VERSION("5.2.1")
GENRE_BY("dumpTc")
)
and print it to stdout.
For this, if I use perl's range operator, everything works fine.
But if I use something as :
...
if(/^HEADER(.*?)GENRE_BY(.*)/) {
print;
}
...
I am not able to get the RE to match:
<code>
HEADER(
LIBDAT("GTASK")
VENDOR("DeltaQ")
Environment("zeronom")
TASK_VERSION("5.2")
GENRE_BY("dumpTc")
)
Or
HEADER(
LIBDAT("GTASK")
VENDOR("DeltaQ")
Environment("zeronom")
TASK_VERSION("5.2")
GENRE_BY("dumpTc")
)
Can you please point out my mistake?
Christina J.
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.