Clear questions and runnable code
get the best and fastest answer
peg - Perl _expression_ (GNU) grep scriptby Clarendon4 (Acolyte)
|on Nov 14, 2008 at 18:00 UTC||Need Help??|
Hope others find "peg" as useful as it has been to me. Give it a try.
Announce - "peg", yet another (GNU) grep like Perl program.
The latest version is available at:http://cpan.mirrors.uk2.net/authors/id/A/AD/ADAVIES/
These are identical:
...searches the input stream, while
...recursively searches each file beneath the cwd.
...looks in .pm & .pl files modified in the last 2 days.
Commonly used -p tests of file extensions can be defined:
...and then used as:
...prints the last matched "sub" line for any lines matching "foo" ie. (probably) the subroutine that contains "foo".
Again, common 'contexts' can be defined:
...and then used as "-z p".
...would then enable
...to search for foo, ignoring all files in or beneath a directory called CVS.
As an optimization of the common case of doing a recursive search, an external program can be configured to feed peg the list of files beneath the current directory. The C program qfind.c which is also available at:http://cpan.mirrors.uk2.net/authors/id/A/AD/ADAVIES/
...is written specifically for this, and provides a significant speed up on Win32 compared to the default of traversing the file system with Perl's File::Find::find. Additionally peg performs parallel processing to maximize performance.