Is there some way to continually compress the output of a program (in almost realtime)?
For example I have this program that produces (a lot of) output to stderr. I want to do something like ./my-program 2> tar -<someoptions> stderroutput.tar.gz
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.
Sign up to join this communityIf I understand correctly, you want to compress the contents of the standard error stream and save it to a file. If so, try this:
./my-program 2>&1 | gzip > stderroutput.gz
tar
does not compress data; it is designed only to archive multiple files into one. To compress streams, you would need to use gzip
, xz
, bzip2
or similar. (While gzip
has the worst compression rate, it is also one of the fastest, so it might be the best choice here.)
For example:
myapp 2> >(gzip > stderr.gz)
or
(myapp 2>&1 1>&3 | gzip > stderr.gz) 3>&1
gzip
/etc to perform compression.