From b5f85b754fe685504bad52ba3147d7e2a64d6ac1 Mon Sep 17 00:00:00 2001 From: btmccrea Date: Tue, 22 Dec 2020 17:04:29 -0500 Subject: [PATCH] Finished script comments and tweeks needed. --- Find_Missing_Addresses.sh | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) mode change 100644 => 100755 Find_Missing_Addresses.sh 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