Hi, I'm trying to do the following:
1. open a file to search for some specific text.
2. take a 'specific range of text' from the line where my search was found.
3. pass the text in the 'specific range' to a variable so i can print it out.
example:
I have the following text in a file. Everything in the line below is in the file along with lots of other text.

<Directory Filename="the_specific_range_of_text_is_in_here" Version="1.9">

1. Now I want to be able to search for the first part which is always constant:
<Directory Filename=
2. Then I want to take everything after the search in #1 above, but only the stuff in between the quotations:
"the_specific_range_of_text_is_in_here"
3. But ignore the text from the rest of the line:
Version="1.9">

Whatever text was in between the quotations in #2 above, I want passed to a variable so I can use this for printing to some output.

I've seen many search and replace scripts, but I can't seem to find anything that does exactly what I want.

Please help.

20040729 Edit by ysth: change /br tags to br/


In reply to search file for text then only use some of the text in the line by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.