Finished script comments and tweeks needed.

This commit is contained in:
btmccrea committed 2020-12-22 17:04:29 -05:00
1 parent 5252fc1932
commit b5f85b754f
1 file changed
+12 -11
Regular → Executable
+12 -11
View File
@@ -16,7 +16,7 @@ while :
do do
echo -e "What is the output directory for the pdf's with missing addresses?" echo -e "What is the output directory for the pdf's with missing addresses?"
#read OUTPUTFOLDER #read OUTPUTFOLDER
OUTPUTFOLDER=/home/btmccrea/Documents/ouput OUTPUTFOLDER=/home/btmccrea/Documents/output/
if [ -d $PDFDIR ]; then if [ -d $PDFDIR ]; then
break break
else else
@@ -24,18 +24,19 @@ do
fi fi
done done
touch "$OUTPUTFOLDER"Addresses.csv
FILES=$(ls $PDFDIR) echo "File, User, Address" > "$OUTPUTFOLDER"Addresses.csv
#FILES=$(ls $PDFDIR)
cd $PDFDIR cd $PDFDIR
echo $FILES #echo $FILES
for f in "$FILES" #* represensts All files in the current directory
for f in *.pdf ;
do do
pdftotext $f - | TEMPFILE pdftotext "$f" temp
ADDRESS=$(awk 'NR == 14 {print ; exit}' TEMPFILE) USER=$(sed -n '13p' temp)
echo $ADDRESS ADDRESS1=$(sed -n '14p' temp)
if [ -z $ADDRESS ]; then ADDRESS2=$(sed -n '15p' temp)
cp $f to $OUTPUTFOLDER echo "$f, $USER, '$ADDRESS1 $ADDRESS2'" >> "$OUTPUTFOLDER"Addresses.csv
fi
done done
exit exit