Sarthak Patnaik wrote:

I have a file:

Text.txt

--------
One
Match Not
Two
Match
Three Four
-------

Now I want to get only the line that has "Match" and not the line "Match
Not".

I used :

cat text.txt | perl -nle 'print $_ if (/Match/)&&(!/Match Not/)'

But I want to do that inside one regular expression.

I think we need to see the real problem, but

 print $_ if /Match$/;

will do what you want here.

Rob

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


Reply via email to