Guest User

Untitled

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