Re: Perl newbie: regexp

2004-06-17 Thread raj
I am clear. Thanks for replying all.

- Original Message - 
From: "Bob Showalter" <[EMAIL PROTECTED]>
To: "'raj'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, June 17, 2004 5:48 PM
Subject: RE: Perl newbie: regexp


> raj wrote:
> > Hello All,
> >I am new to perl. I want to display the lines which
> > have "Testing" word. I have to do this in command line.
> > 
> > I tried the with following options. Its not work what I expected. It
> > dispalys all lines.
> > 
> > perl -p -e 'print if /Testing/m' test.txt
> 
> -p should be changed to -n. Also, you don't need the /m modifier on the
> regex.
> 
> see perldoc perlrun for explanation of -p and -n.
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
> 
> 
> 


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.707 / Virus Database: 463 - Release Date: 6/15/2004

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




RE: Perl newbie: regexp

2004-06-17 Thread Bob Showalter
raj wrote:
> Hello All,
>I am new to perl. I want to display the lines which
> have "Testing" word. I have to do this in command line.
> 
> I tried the with following options. Its not work what I expected. It
> dispalys all lines.
> 
> perl -p -e 'print if /Testing/m' test.txt

-p should be changed to -n. Also, you don't need the /m modifier on the
regex.

see perldoc perlrun for explanation of -p and -n.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Perl newbie: regexp

2004-06-17 Thread Roberto Etcheverry
This will do it:
perl -n -e 'print if /Testing/m' test.txt
'-p' prints every line in the file so you'll see the matching lines 
twice (one because of '-p' and the other because of 'print') and the 
non-matching lines once (because of '-p').
Look  in 'perldoc perlrun'  for differences on '-p' and '-n'.

raj wrote:
Hello All,
  I am new to perl. I want to display the lines which have
"Testing" word. I have to do this in command line.
I tried the with following options. Its not work what I expected. It
dispalys all lines.
perl -p -e 'print if /Testing/m' test.txt
ANy help much appreciated!
Regs,
Durai.
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.698 / Virus Database: 455 - Release Date: 6/2/2004
 


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Perl newbie: regexp

2004-06-17 Thread raj
Hello All,
   I am new to perl. I want to display the lines which have
"Testing" word. I have to do this in command line.

I tried the with following options. Its not work what I expected. It
dispalys all lines.

perl -p -e 'print if /Testing/m' test.txt

ANy help much appreciated!

Regs,
Durai.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.698 / Virus Database: 455 - Release Date: 6/2/2004


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]