Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: grep -P

by sgifford (Prior)
on Jun 26, 2006 at 01:46 UTC ( #557500=note: print w/replies, xml ) Need Help??


in reply to grep -P

If you don't need the more complex command-line options of grep, you can just use perl -ne 'print if (/pat/)'. Even the trickier options usually come down to just a small variation on that theme.

Replies are listed 'Best First'.
Re^2: grep -P
by tomazos (Deacon) on Jun 26, 2006 at 03:08 UTC
    I guess -R (recurse directory) and -l (print filenames containing matches) are two that I use often. The one liner is a bit of a mouthful.

    But just for fun:

    perl -MFile::Find -ne 'find(& sub { $f = 1; if (/pat/ and $f) { $f = 0 +; print $File::Find::name . "\n" }, "mydir");'

    ...or something like that.

    -Andrew.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (1)
As of 2023-09-28 01:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?