You can use bzgrep
instead of bzcat
and grep
. This is faster.
To grep recursively in a directory tree use find
:
find -type f -name '*.bz2' -execdir bzgrep "pattern" {} \;
find
is searching recursively for all files with the *.bz2
extension and applies the command specified with -execdir
to them.