profile
viewpoint

Ask questionszstdgrep does not correctly handle the -f argument of grep

The -f argument of grep behaves similarly to -e, in that it removes the need to pass the pattern string as a positional argument. Zstdgrep does not handle this correctly, and treats the first filename as if it were a pattern; as a result, the first file does not get decompressed when passing a pattern via -f.

For example, the zstdgrep command:

zstdgrep -E -f pattern.txt foo.zst bar.zst baz.zst

should be expanded into something like:

"zstdcat" -fq -- "foo.zst" | "grep" --label="foo.zst" -H  -E -f pattern.txt -
"zstdcat" -fq -- "bar.zst" | "grep" --label="bar.zst" -H  -E -f pattern.txt -
"zstdcat" -fq -- "baz.zst" | "grep" --label="baz.zst" -H  -E -f pattern.txt -

However, it's currently wrongly expanded as:

"zstdcat" -fq -- "bar.zst" | "grep" --label="bar.zst" -H  -E -f pattern.txt -- "foo.zst" -
"zstdcat" -fq -- "baz.zst" | "grep" --label="baz.zst" -H  -E -f pattern.txt -- "foo.zst" -
facebook/zstd

Answer questions felixhandte

Hi @codeman38, I've merged a fix into dev that addresses your issue. Let me know if you have any problems!

useful!

Related questions

No questions were found.
source:https://uonfu.com/
answerer
Felix Handte felixhandte @facebook New York. NY felixhandte.com Software Engineer on @facebook's Data Compression Team
Github User Rank List