diff --git a/Find_Missing_Addresses.sh b/Find_Missing_Addresses.sh old mode 100644 new mode 100755 index 8098132..553c0d6 --- a/Find_Missing_Addresses.sh +++ b/Find_Missing_Addresses.sh @@ -16,7 +16,7 @@ while : do echo -e "What is the output directory for the pdf's with missing addresses?" #read OUTPUTFOLDER - OUTPUTFOLDER=/home/btmccrea/Documents/ouput + OUTPUTFOLDER=/home/btmccrea/Documents/output/ if [ -d $PDFDIR ]; then break else @@ -24,18 +24,19 @@ do fi done - -FILES=$(ls $PDFDIR) +touch "$OUTPUTFOLDER"Addresses.csv +echo "File, User, Address" > "$OUTPUTFOLDER"Addresses.csv +#FILES=$(ls $PDFDIR) cd $PDFDIR -echo $FILES -for f in "$FILES" +#echo $FILES +#* represensts All files in the current directory +for f in *.pdf ; do - pdftotext $f - | TEMPFILE - ADDRESS=$(awk 'NR == 14 {print ; exit}' TEMPFILE) - echo $ADDRESS - if [ -z $ADDRESS ]; then - cp $f to $OUTPUTFOLDER - fi + pdftotext "$f" temp + USER=$(sed -n '13p' temp) + ADDRESS1=$(sed -n '14p' temp) + ADDRESS2=$(sed -n '15p' temp) + echo "$f, $USER, '$ADDRESS1 $ADDRESS2'" >> "$OUTPUTFOLDER"Addresses.csv done exit