Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Retrive content size of an lz4 compressed file.
- # Compatible only with lz4 files created with --content-size flag
- file="$1"
- if ! file "$file" | grep LZ4 > /dev/null; then
- printf "%s: Is not recognised as a lz4 file\\n" "$file" >&2
- exit 1
- fi
- csflag=$(od -An -t x2 -N 1 -j 4 "$file" | xargs)
- if [ ! "$csflag" == "006c" ]; then
- printf "%s: No content-size flag\\n" "$file" >&2
- exit 1
- fi
- printf "%s: " "$file"
- od -An -t d -N 8 -j 6 "$file" | awk '{print $1}'
Add Comment
Please, Sign In to add comment