New answers tagged

1

The information about the uncompressed size of the file (actually of the uncompressed size of the last chunk as gzip files can be concatenated together) is stored as a little endian 32 bit integer in the last 4 bytes of the file. To output that information, gzip -l seeks to the end of the file, reads those 4 bytes (actually, according to strace, it reads ...


3

Your second command works, the issue is you are using bash or whatever shell that put all pipelines components in a subshell. myresult2 is properly set but the variable is immediately out of scope unless you stay in the same subshell like here: curl -L 'https://archive.org/wayback/available?url=stackoverflow.com' \ 2>/dev/null | { myresult2=$(...


4

This command $ tmp="$(cat tmp.csv.gz)" && echo "$tmp" | gzip -l assigns the content of tmp.csv.gz to a shell variable and attempts to use echo to pipe that to gzip. But the shell's capabilities get in the way (null characters are omitted). You can see this by a test-script: #!/bin/sh tmp="$(cat tmp.csv.gz)" && echo "$tmp" |cat >foo....


0

Seems like gzip cannot recognize the name of file when getting its input from pipe. I did a test like this: $ cat file.tar.gz | gzip -tv OK $ gzip -tv file.tar.gz file.tar.gz: OK So in first case gzip is unable to recognize the name of file which seems to be necessary for the -l flag (you can see on the last column of output uncompressed_name is ...



Top 50 recent answers are included