CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate: Re: [Laurent_R] Wrapper around the UNIX find | xargs grep: Edit Log



panicz
Novice

Jan 26, 2013, 3:00 AM


Views: 1532
Re: [Laurent_R] Wrapper around the UNIX find | xargs grep

The idea of the code is very simple:
it is invoked as

Code
search CLAUSE*

where

Code
CLAUSE ::= 
"from" $from
| "in" $in[0] ("or" @in)*
| "for" $for[0] ("or" @for)*

so for instance it can be called like that:

Code
# search in '*.php' for 'join' 
# search from ~/ for $USER
...

internally it runs

Code
system("find ".($from or "./")." " 
.(@in?" -name ".join(" -or -name ", @in):"")
.(@for?"|xargs grep -e ".join(" -e ", @for):""));

where @for and @in are arrays obtained from processing appropriate clauses. The only problem that i have is with processing those clauses.
It would be perfect if the source code was similar to what i wrote here, because i think it's the best way to explain what i mean.


(This post was edited by panicz on Jan 26, 2013, 1:32 PM)


Edit Log:
Post edited by panicz (Novice) on Jan 26, 2013, 11:06 AM
Post edited by panicz (Novice) on Jan 26, 2013, 1:32 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives