[Chapter 27] 27.13 More grep-like Programs Written in Perl (an outdated but still useful “Unix Power Tools” edition somewhere on a web-server discusses it)
The pipegrep program greps the output of a series of commands. The difficulty with doing this using the normal grep program is that you lose track of which file was being processed. This program prints out the command it was executing at the time, including the filename. The command, which is a single argument, will be executed once for each file in the list. If you give the string {} anywhere in the command, the filename will be substituted at that point. Otherwise the filename will be added on to the end of the command. This program has one option, -l, which causes it to list the files containing the pattern.
Follow the above link for a nice example!
I remembered the pipegrep utility today, because I came across a task …
Update 2013-10-17:
- http://shop.oreilly.com/product/9780937175644.do – Programming Perl (1st ed.) released in January 1991
- http://examples.oreilly.com/9780937175644/ – there you find the code in a TAR ball
Leave a Reply