To get uncompressed size of already compressed file, I can use -l option in gzip utility:
gzip -l compressedfile.gz
However is there a way to get size of compressed file if I am piping the output? For example using this command:
gzip -fc testfile > testfile.gz
or specifically if I am redirecting output somewhere where I might not have direct access (server)
gzip -fc testfile > /dev/null
gzip -fc testfile | ssh serverip "cat > file.gz"
Can this be done? I need either the compression ratio or the compressed size.
Best Answer
dd
to the rescue.or in your
ssh
exampleAnd then just parse the output of the commands using awk or somesuch to pluck out the crucial part of the last line.