On Mar 2, 9:55 am, lm7...@gmail.com (Matt) wrote:
> I am looking for a simple way to test if a file does not contain a
> string.  This is on a linux box.
>
> if myfile does not contain mystring {
>   #do_something;
>   }
>
> The file is basically a list of names and I want to test that a
> certain name is not in there.  Is there an easy way to do that?

Yet another way:

perl -0777 -nlE ' say /mystring/ ? "yes" : "no" '  file

See: perldoc perlrun for explanation of -0777

--
Charles DeRykus


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to