Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Perl in one line

by mwah (Hermit)
on Nov 08, 2007 at 12:57 UTC ( [id://649707]=note: print w/replies, xml ) Need Help??


in reply to Perl in one line

cat file | grep -e str1 -e str2

I'd think there are at least 10 different and reasonable versions of the above command possible in Perl, one would sth. read like:

perl -ne 'print if /str1/ || /str2/' file

Addendum: To use this under Windows, please replace the quotes, e.g.:

C:\> perl -ne "print if /str1/ || /str2/" file

Regards

mwa

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://649707]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-04-16 10:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found