Last active
August 7, 2020 16:53
-
-
Save pachadotdev/16c0fc09acca268dfe395b936a92e085 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -o nounset | |
case "${1:-}" in | |
--) | |
pdf="$2" | |
html="${pdf%.pdf}".html | |
dest="${html}".gz | |
[ -e "$dest" ] && exit | |
pdftohtml -nodrm -s -i -noframes -stdout "$pdf" | |
if grep <"$html" -E -v 'PADRÓN +AUDITADO +PLEBISCITO +NACIONAL +2020' | gzip -9 >"$dest"; then | |
rm -vf "$html" | |
fi | |
;; | |
*) | |
tsp pdftohtml -S 8 | |
for x in *.pdf; do | |
tsp pdftohtml "${BASH_SOURCE[0]}" -- "$x" | |
done | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment