1

This question discussed how to remove parentheses from simple uncompressed text files.

The accepted answer suggested the following:

cat in_file | tr -d '()' > out_file

To my observation, however, this answer is not able to produce the desired effect on compressed text files using gzip.

Is there any way to remove parentheses from text files compressed with gzip without uncompressing them?

1
  • 4
    No, you can't meaningfully change the contents of a compressed file without decompressing it. Also, useless use of cat. – Satō Katsura Mar 27 '18 at 16:55
8

No, at best you can do it without writing the decompressed file to disk, but you do need to decompress it in order to edit it.

 zcat in_file.gz | tr -d '()' | gzip -c >out_file.gz

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.