How to replace zgrep with pigz

When you are running zgrep you are basically actually running gzip with the decompression options piped to grep.

So to replace zgrep with pigz (to make it much much much faster), just pigz -dc the file piped to grep (which is basically what zgrep is doing).  Except as you know pigz will automatically thread out for the number of cores in your hosts to make it super fast.

Here's an example from one of my scripts.

BEFORE:

  zgrep "$firm" /u/pound.log-20170${i}${y}.gz 


WHICH IS REALLY 

gzip -cdfq -- /u/pound.log-20170${i}${y}.gz |grep "$firm" 


WHICH I REPLACED WITH: 

pigz -dc /u/pound.log-20170${i}${y}.gz | grep "$firm" 


Error

Anonymous comments are disabled in this journal

default userpic

Your reply will be screened