Skip to content

Instantly share code, notes, and snippets.

@eiro
Created October 1, 2019 19:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eiro/0ff057f154e811ba370c944d4e8fc169 to your computer and use it in GitHub Desktop.
Save eiro/0ff057f154e811ba370c944d4e8fc169 to your computer and use it in GitHub Desktop.
detect the fat of your pdf
count_fat () awk -vmd5=1 -vfile=2 '
{ ++used[$md5] ; name[$md5]=$file }
END {
# is fat only if used more than 1 time
for (n in name)
if (--used[n])
print name[n],used[n]
}
'
total_fat () awk -vtimes=2 -vsize=3 '
{ sum += $times * $size }
END { print sum }
'
md5sum videos/* |
count_fat |
tee fat |
awk '{print $1}' |
xargs stat -c '%n %s' > sizes
{ join fat sizes | total_fat
stat -c%s *.pdf
print '10k/100*p'
} |dc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment