|Syntactic Confectionery Delight|
Re^3: How to print the lines immediately above and below a matching line?by afoken (Prior)
|on Nov 26, 2012 at 19:16 UTC||Need Help??|
but do you really want to qx this on a 4 GByte file?
No. I would not use Perl at all just to call grep. My shell can start grep fine without needing Perl.
4 GByte should be no problem for grep, at least not for GNU grep. Actually, I expect grep to be at least as fast as a perl script, and I expect it to use less memory. Simply because grep is optimized for exactly that job.
By the way: grep has lots of other useful options, like showing line numbers and/or file names, again no need to write Perl code.
A quite useful alternative to grep is ack. It shares many features with GNU grep, and does some things better. ack ignores files and directories you typically do not want to search by default, it uses Perl regexp syntax instead of "basic" or "extended" regexp syntax, and it has a configuration file.
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)