2 ms·
It's for searching inside of compressed files, and does this by decompressing to a temporary directory.
by opencl 4y ago
It's for searching inside of compressed files, and does this by decompressing to a temporary directory.
- deathanatos 4y ago… that is also shocking… it wouldn't just stream the decompression, perhaps piping the decompressed stream into grep itself?
- TheDong 4y agozgrep does stream directly from gzip into grep. You can see that here: https://git.savannah.gnu.org/cgit/gzip.git/tree/zgrep.in?id=dc9740df61e575e8c3148b7bd3c147a81ea00c7c#n204 https://git.savannah.gnu.org/cgit/gzip.git/tree/zgrep.in?id=... It's also mentioned in one of the few comments in zgrep: https://git.savannah.gnu.org/cgit/gzip.git/tree/zgrep.in?id=dc9740df61e575e8c3148b7bd3c147a81ea00c7c#n116 https://git.savannah.gnu.org/cgit/gzip.git/tree/zgrep.in?id=... > we use stdin to pass the gzip output to grep zgrep does create a temporary directory to store the grep search pattern, but only if the pattern is passed via `zgrep -f`, and only if the pattern passed in is not a regular file (i.e. `zgrep -f <(echo "foo") some_file.gz` would create a temporary file with the contents "foo", not with the contents of some_file.gz, and `zgrep -f pattern_file search_file.gz` would not create any temporary file)