Thanks John for the reply.

I included the code as you suggested, but does'nt seem to work.
The output file is empty.

-rajini










On Wed, Mar 25, 2009 at 12:19 AM, John W. Krahn <jwkr...@shaw.ca> wrote:

> Rajini Naidu wrote:
>
>> Hi,
>>
>
> Hello,
>
>
> I am trying to search for a pattern in a file in my perl script.
>> Syntax used is :
>>
>> system("grep \"$res\" ${data_dir}/${node}.load >
>> /tmp/${day[0]}.${day[1]}.${day[2]}.${node}.log");
>>
>> But the grep command is'nt successful in getting the desired string.
>>
>> Am I missing anything here ?
>>
>
> open my $IN,  '<', "$data_dir/$node.load" or die "Cannot open
> '$data_dir/$node.load' $!";
> open my $OUT, '>', "/tmp/$day[0].$day[1].$day[2].$node.log" or die "Cannot
> open '/tmp/$day[0].$day[1].$day[2].$node.log' $!";
>
> while ( <$IN> ) {
>    next unless /$res/;
>    print $OUT $_;
>    }
>
>
>
> John
> --
> Those people who think they know everything are a great
> annoyance to those of us who do.        -- Isaac Asimov
>
> --
> To unsubscribe, e-mail: beginners-unsubscr...@perl.org
> For additional commands, e-mail: beginners-h...@perl.org
> http://learn.perl.org/
>
>
>

Reply via email to