How do I maintain a readable output from my program while also putting that same output into a compressed file, gzip or otherwise, so I can parse it later?
I run a command that generates a lot of samey lines of clear text that should be easy to compress, but I also want to monitor the output of that command. I know I can use tee to print and then put stdin into a file. But the files are massive (250MB+). I also know that I can use gzip to compress stdin into a file, but then I won't see any output on the screen and gzip's --stdout flag just dumps the compressed data to stdout, which is not what I want.
An example would be
python -c 'for i in range(0, 100): print("A" * 120)' | gzip --best > A.log.gz
but I also want to see the As printed to the console.
seq 1 100 | tee >(gzip >foo.gz)– Bodo Mar 20 '23 at 15:06teewith a process substitution for thegzipcommand, or pee. See alsoteefor commands – steeldriver Mar 20 '23 at 15:06>(program)syntax is new to me. – FalcoGer Mar 20 '23 at 15:43>(process)in place of any file name and the data that would be written to that file would appear as stdin to that process instead? Thank you, I didn't know that. – FalcoGer Mar 20 '23 at 15:48