Beefy Boxes and Bandwidth Generously Provided by pair Networks chromatic writing perl on a camel
P is for Practical
 
PerlMonks  

Re: Private Utilities

by belg4mit (Prior)
on Nov 30, 2005 at 15:41 UTC ( [id://513094]=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 Private Utilities

That's similar in utility to something I spoke about in the CB awhile back, bart said he'd like it and I started but haven't finished... It was aplopos, an apropos for your installed module base.

I have this, quotemeta for pipes e.g; find -name *.pl | quotemeta | xargs grep foo

#perl -p s/([ '"$*?()\[\]])/\\$1/g;
And this icky URIgrep:
#perl -l -O777 $_=<>;while(m/(\w+:\/\/[-a-zA-Z0-9\$_.+!*'(),?\/\%\&=~:]+)/g){print$1; +}

--
In Bob We Trust, All Others Bring Data.

Replies are listed 'Best First'.
Re^2: Private Utilities
by Eimi Metamorphoumai (Deacon) on Nov 30, 2005 at 19:59 UTC
    I can see some uses for your quotemeta for pipes, but the use you mentioned is more easily written as
    find -name \*.pl -print0 | xargs -0 grep foo
    which has the advantage of quoting all nasty filename characters (for instance, new lines, tabs, etc).
      If you have newlines in your filenames you've issues IMHO. As for "more easily" well, I don't find your idiom particularly intuitive (it relies upon two arcane swtiches and you're sort of repeating yourself). Besides, I don't use the tool as much as I could because it always slips my mind, the more I use it the more I'll use it :-P

      It's interesting to know there's an option, maybe I'll include some variant as the default when I get around to writing the trivial wrapper that accepts arguments in the right order. POSIX be damned, find is grep-ing the filesystem and it ought to be find EXPR PATH

      --
      In Bob We Trust, All Others Bring Data.

      Except that not all finds and xargss have this feature. The ones included with Solaris, for example.

      thor

      The only easy day was yesterday

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://513094]
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.