Hi I have two files ,the first data.txt which contain the following:
me.pl~23~note~345~sente you.pl~25~warning~345~sente he.pl~21~note~345~sente she.pl~123~warning~345~sente they.pl~233~warning~345~sente them.pl~26~note~345~sente
where the fist number appear in each line is a line number in that code now in my second file which is lineChanges.txt , I have the following
you.pl 24-28 they.pl 36 them.pl 44-49 you.pl 234 77
which are lines that changed in a code, 24-28 means 24 to 28 ... so what I need to do is reading from the lineChanges.txt file each line and see if the .pl file appears in the first file data.txt , if it does then I want to see if the lines number matches or in the same range and it is a warning , if it match and it is a warning then I want to get the hole line and send it to a file . example you.pl appears in both files the lines for you.pl in the lineChanges.txt are 24 to 28 and in data.txt is 25 , line 25 which is in the range of 24-28 appear and it is a warning so that is what I am looking for so I copy the hole line
you.pl~25~warning~345~sente
to an output file .... can someone tell me how to do that or give me a hint :) thanks

In reply to Reqex from two files and compare by DS

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.