Skip to content

Instantly share code, notes, and snippets.

@dginev
Last active October 1, 2024 20:32
Show Gist options
  • Save dginev/711ef34a5ce104670cc55a5ef33beac5 to your computer and use it in GitHub Desktop.
Save dginev/711ef34a5ce104670cc55a5ef33beac5 to your computer and use it in GitHub Desktop.
Counting all files contained in ZIP archives of a given name, in a directory with symbolic links
$ find -L -name "tex_to_html.zip" -exec unzip -l {} \; \
  | grep files \
  | awk -F: '{ split($0,a," "); print(a[2]); }' \
  > all_files_in_zips.log
  
$ ALLFILES=$(paste -sd+ all_files_in_zips.log | bc)

$ ALLZIPS=$(wc -l all_files_in_zips.log|awk -F' ' '{print $1}')

$ AVG_FILES_PER_ZIP=$((ALLFILES / ALLZIPS ))

$ echo $AVG_FILES_PER_ZIP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment