Beefy Boxes and Bandwidth Generously Provided by pair Networks chromatic writing perl on a camel
No such thing as a small change
 
PerlMonks  

Re: Strange grep and matching behaviour...

by vladb (Vicar)
on May 22, 2002 at 17:27 UTC ( [id://168594]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Strange grep and matching behaviour...

How about this:
sysopen (FILE,$filename,O_RDONLY) or die "Error! $!\n"; my (@slurp) = grep !/fubar/,<FILE>; close FILE;
Let the almighty grep take care of filtering all lines containing 'foobar' out. The match should do it just fine.

I tested similar script with this command:
echo 'fubar\nfoo' | perl -e '@stuff=grep \!/fubar/, <STDIN>;print@stuf +f;'
This would only print:
foo
and filter the 'foobar' line out! ;-)

UPDATE: owww, and how did I miss so many earlier posts!? I'm sorry Ovid, I didn't notice your post which makes my look like nothing but straight copy. ;/.

_____________________
$"=q;grep;;$,=q"grep";for(`find . -name ".saves*~"`){s;$/;;;/(.*-(\d+) +-.*)$/;$_=&#91"ps -e -o pid | "," $2 | "," -v "," "&#93;`@$_`?{print" ++ $1"}:{print"- $1"}&&`rm $1`;print"\n";}

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://168594]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.