Grope, a Ruby script for enhanced Grepping
on Wednesday 19th March, 2008 Gabe speculated thusly…There was a time when I would recursively grep the contents of literally thousands of files at a time to search for particular occurances of characters. The usual starting place was something using grep, which we can time for crude benchmarking:
user@localhost$ time grep -rn 'hello' *
templates/temp.tpl:1:hello
real 1m56.190s
user 0m1.400s
sys 0m0.940s
Using Ruby to write a script, which I named Grope, I made the search process 450 times faster, reducing an operation that took more than a minute to taking a blink of an eye…
user@localhost$ time grope 'hello'
templates/festival/06/temp.tpl: 1
hello...
real 0m0.181s
user 0m0.100s
sys 0m0.070s