Being a beginner myself, this might work, but someone else may have a 
better solution...

$INFILE = "Your_Input_File.txt" ;
open (OUTFILE, ">Your_Output_File.txt";) or die;
open (INFILE) or die;

while ($line  = <INFILE>)
{
chomp ($line);
if ($line =~ /(whatever expression you're looking for)/)
    {
     print OUTFILE $1;
    }
}
close (INFILE);
close (OUTFILE);

Hope this helps.

At 06:31 AM 5/8/01 -0700, Ga Bu wrote:
>Hi everyone,
>
>I am fairly new to perl and having problems with
>pulling in multiple lines from a file so I can search
>those lines and if it has the expression I am looking
>for then I want to return to that file and search
>again for the same pattern of lines again and then
>search again for the pattern in those line and save it
>to a file.
>
>Between each group of text is a "!" exclamation point.
>
>
>!
>line of text 1
>line of text 2
>line of text 3
>!
>line of text 4
>line of text 5
>!
>
>and so on.
>
>
>
>Thanks in advance everyone.
>
>Gary Butler
>
>
>
>__________________________________________________
>Do You Yahoo!?
>Yahoo! Auctions - buy the things you want at great prices
>http://auctions.yahoo.com/

Reply via email to