improved handling of addresses and spaced them out to more columns
This commit is contained in:
1 parent
c89f61366c
commit
612943e9f8
1 file changed
+10
-4
@@ -30,7 +30,7 @@ done
|
|||||||
#Create the csv and headers for the Addresses. It is tab separated.
|
#Create the csv and headers for the Addresses. It is tab separated.
|
||||||
mkdir $OUTPUTFOLDER/Non_Blank
|
mkdir $OUTPUTFOLDER/Non_Blank
|
||||||
touch $OUTPUTFOLDER/Non_Blank/Addresses.csv
|
touch $OUTPUTFOLDER/Non_Blank/Addresses.csv
|
||||||
echo -e "File\tUser\tAddress" > $OUTPUTFOLDER/Non_Blank/kkAddresses.csv
|
echo -e "File,User,Street,City,State,Zip" > $OUTPUTFOLDER/Non_Blank/Addresses.csv
|
||||||
|
|
||||||
#Create csv with all the files with missing addresses
|
#Create csv with all the files with missing addresses
|
||||||
mkdir $OUTPUTFOLDER/Missing_Addresses
|
mkdir $OUTPUTFOLDER/Missing_Addresses
|
||||||
@@ -40,14 +40,13 @@ echo -e "File\tUser" > $OUTPUTFOLDER/Missing_Addresses/Missing_Addresses.csv
|
|||||||
|
|
||||||
cd $PDFDIR
|
cd $PDFDIR
|
||||||
#FOLDER=$(ls | grep *.pdf)
|
#FOLDER=$(ls | grep *.pdf)
|
||||||
echo $FOLDER
|
#echo $FOLDER
|
||||||
#*.pdf represensts All files in the current directory with a pdf extention.
|
#*.pdf represensts All files in the current directory with a pdf extention.
|
||||||
for f in $PDFDIR/*
|
for f in $PDFDIR/*
|
||||||
do
|
do
|
||||||
echo "Processing file $f."
|
echo "Processing file $f."
|
||||||
#pdftotext converst the file to text and places it in the file name temp
|
#pdftotext converst the file to text and places it in the file name temp
|
||||||
pdftotext "$f" - > TEMP
|
pdftotext "$f" - > TEMP
|
||||||
#cat TEMP
|
|
||||||
#assigns the lines with relevant values to their variable
|
#assigns the lines with relevant values to their variable
|
||||||
USER=$(sed -n '12p' TEMP)
|
USER=$(sed -n '12p' TEMP)
|
||||||
ADDRESS1=$(sed -n '13p' TEMP)
|
ADDRESS1=$(sed -n '13p' TEMP)
|
||||||
@@ -62,7 +61,14 @@ do
|
|||||||
echo -e "$f\t$USER" >> "$OUTPUTFOLDER"/Missing_Addresses/Missing_Addresses.csv
|
echo -e "$f\t$USER" >> "$OUTPUTFOLDER"/Missing_Addresses/Missing_Addresses.csv
|
||||||
#Adds the row of variables to the csv. >> appends to the file. \t represents tabs
|
#Adds the row of variables to the csv. >> appends to the file. \t represents tabs
|
||||||
else
|
else
|
||||||
echo -e "$f\t$USER\t$ADDRESS1 $ADDRESS2" >> $OUTPUTFOLDER/Non_Blank/Addresses.csv
|
# Split Addresses
|
||||||
|
CITY=$(echo $ADDRESS2 | cut -d, -f1)
|
||||||
|
ADDRESS2=$(echo $ADDRESS2 | sed -e "s/$CITY, //")
|
||||||
|
|
||||||
|
STATE=$(echo $ADDRESS2 | cut -d" " -f1)
|
||||||
|
ZIP=$(echo $ADDRESS2 | cut -d" " -f2)
|
||||||
|
|
||||||
|
echo -e "$f,$USER,$ADDRESS1,$CITY,$STATE,$ZIP" >> $OUTPUTFOLDER/Non_Blank/Addresses.csv
|
||||||
cp "$f" $OUTPUTFOLDER/Non_Blank/
|
cp "$f" $OUTPUTFOLDER/Non_Blank/
|
||||||
echo -e "Copying file to Non_Blank"
|
echo -e "Copying file to Non_Blank"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in new issue
Block a user