Something I’ve only just noticed, but I find it interesting. If it’s already known to you, then be happy. :-)
$ time grep -i 'closing' error_log | wc -l real 0m2.144 user 0m2.139s sys 0m0.011s
The above is with the default grep, using ‘-i’ to search case insensitive.
$ time grep -iP 'closing' error_log | wc -l real 0m0.104s user 0m0.095s sys 0m0.012s
The above uses -P
, or the Perl Regular Expressions. In this example, that’s 20x faster than regular grep! You loose that advantage as soon as you search case sensitive, but if you’re a fan of -i
, become a fan of -P
as well.
Can anyone say alias grep='grep -P'
?