Link to home
Start Free TrialLog in
Avatar of bt707
bt707Flag for United States of America

asked on

perl paragraph mode search


I use a perl command to search a group of lines like:

perl -00 -ne 'print if /keyword/' txtfile1

how can i make this find the groups that does NOT contain the key word i use.
In other words    "if Not"

Thanks,
ASKER CERTIFIED SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bt707

ASKER

thanks ozo
Avatar of manav_mathur
manav_mathur

Wouldnt a simple 'grep' be effeicient in this case.....
perl -00 -e 'print grep{not /keyword/}<>' txtfile1
would need to read the entire file into memory before printing anything.
I meant a Unix grep. That's supposed to be more optimized for this kind of things....no??
Yes, although Unix grep searches for lines, not paragraphs.
You could convert paragraphs to lines | grep | convert lines back to paragraphs