Files
eoy-pdf-sortandmerge/Find_Missing_Addresses.sh
T
2020-12-18 13:14:05 -05:00

44 lines
796 B
Bash

#!/bin/bash
while :
do
echo -e "What is the directory with the pdfs?"
#read PDFDIR
PDFDIR=/home/btmccrea/Downloads/pdfs/
if [ -d $PDFDIR ]; then
break
else
echo -e "Directory not found."
fi
done
while :
do
echo -e "What is the output directory for the pdf's with missing addresses?"
#read OUTPUTFOLDER
OUTPUTFOLDER=/home/btmccrea/Documents/ouput
if [ -d $PDFDIR ]; then
break
else
echo -e "Directory not found."
fi
done
FILES=$(ls $PDFDIR)
cd $PDFDIR
echo $FILES
for f in "$FILES"
do
pdftotext $f - | TEMPFILE
ADDRESS=$(awk 'NR == 14 {print ; exit}' TEMPFILE)
echo $ADDRESS
if [ -z $ADDRESS ]; then
cp $f to $OUTPUTFOLDER
fi
done
exit