> Hi:
>
> In the following perl script, I would like to print all the lines in a
file
> (mdout_short.txt) to temp.txt which have "NSTEP" as a word:
>
> ************************************************
> use strict;
> use warnings;
>
> my $mdout_file = "mdout_short.txt";
>
> my $mdout_xtemp_file = "temp.txt";
>
>
> open IN, $mdout_file or die;
> open OUT, ">> $mdout_xtemp_file" or die;
>
>
> while (<IN>)
>
>                        {
>
>                    print OUT ( $_ =~ ( / NSTEP/ ))
>
>                        }
>
> ************************************************************
> But this just prints
> ......
> i mean only "6 dots" for six occurences/ matches. How can I get the
> "physical" lines printed rather than these dots?
>
> Cheers,
> Vineet

If you plan to match NSTEP as a word, it would be useful to incude \b
metachar in your regex

while(<IN>) {
print OUT $_ if /\bNSTEP\b/ ;
}



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to