Compare commits

...
22 Commits
Author SHA1 Message Date
TRBC Developer bc361b4127 Update file README.md 2024-01-24 13:25:40 +00:00
TRBC Developer a7113367e7 Update file README.md 2024-01-24 13:25:16 +00:00
TRBC Developer 03b5b5d7df Update file Run.sh 2024-01-24 13:24:28 +00:00
TRBC Developer ae55276298 Update file Run.sh 2024-01-24 13:22:20 +00:00
TRBC Developer 59e0b7c489 Update file README.md 2024-01-24 13:21:11 +00:00
TRBC Developer 8346d2e3ea Update file README.md 2024-01-24 13:20:22 +00:00
TRBC Developer fc89b0662d updating 2024-01-24 13:12:36 +00:00
TRBC Developer 3cf3404f73 updating 2024-01-24 13:05:50 +00:00
TRBC Developer 9df136d24a removing questions 2024-01-22 16:49:43 +00:00
TRBC Developer 6930351401 removing questions 2024-01-22 16:48:32 +00:00
TRBC Developer 053b3ef75f Adding in questions 2024-01-22 16:46:56 +00:00
TRBC Developer e89085043b Add new file 2024-01-22 16:24:26 +00:00
TRBC Developer 78462e55a9 added ending statements 2024-01-22 16:19:12 +00:00
TRBC Developer 2afc7b8fe9 Made easier to understand 2024-01-18 20:25:48 +00:00
TRBC Developer 3f28e1d023 Reworded the statements to make it easier to understand 2024-01-18 20:09:24 +00:00
TRBC Developer f02850cd2a Adding / for foder and file seperation 2024-01-18 16:03:56 +00:00
btmccrea 612943e9f8 improved handling of addresses and spaced them out to more columns 2023-01-20 11:09:13 -05:00
btmccrea c89f61366c Commened out hard links and fixed some bugs 2023-01-14 16:44:25 -05:00
btmccrea 628cffcbda Fixed problems with 2020 file and logic improvments 2021-01-24 08:36:11 -05:00
btmccrea 2fb552ed8a Finished Find Addresses. Starte Remove and Sort scripts 2020-12-23 16:26:31 -05:00
btmccrea b5f85b754f Finished script comments and tweeks needed. 2020-12-22 17:04:29 -05:00
sharkmccoy 5252fc1932 Created files 2020-12-18 13:14:05 -05:00
5 changed files with 315 additions and 1 deletions

No files matched your search

+82
View File
@@ -0,0 +1,82 @@
#!/bin/bash
#Get the folder with the pdf documents in it.
#echo ""
#echo "This will sort out the addresses in all the Statement PDF's into 2 folders so that you can then run the Merge file."
#echo "To get started please answer 2 questions."
#while :
#do
# echo -e "Where is the directory with ALL the pdf statments?"
# read PDFDIR
# if [ -d $PDFDIR ]
# then
# break
# else
# echo "Directory not found."
# fi
#done
#Get the folder for the output file.
#echo ""
#while :
#do
# echo -e "What output directory do you want for the sorted pdf's? This will sort into 2 folders, Missing_Addresses and Address"
# read OUTPUTFOLDER
# if [ -d $OUTPUTFOLDER ]
# then
# break
# else
# echo "Directory not found."
# fi
#done
#Create the csv and headers for the Addresses. It is tab separated.
mkdir $OUTPUTFOLDER/Addresses
touch $OUTPUTFOLDER/Addresses/Addresses.csv
echo -e "File,User,Street,City,State,Zip" > $OUTPUTFOLDER/Addresses/Addresses.csv
#Create csv with all the files with missing addresses
mkdir $OUTPUTFOLDER/Missing_Addresses
touch $OUTPUTFOLDER/Missing_Addresses/Missing_Addresses.csv
echo -e "File\tUser" > $OUTPUTFOLDER/Missing_Addresses/Missing_Addresses.csv
cd $PDFDIR
#FOLDER=$(ls | grep *.pdf)
#echo $FOLDER
#*.pdf represensts All files in the current directory with a pdf extention.
for f in $PDFDIR/*
do
echo "Processing file $f."
#pdftotext converst the file to text and places it in the file name temp
pdftotext "$f" - > TEMP
#assigns the lines with relevant values to their variable
USER=$(sed -n '12p' TEMP)
ADDRESS1=$(sed -n '13p' TEMP)
ADDRESS2=$(sed -n '14p' TEMP)
echo -e "User is $USER"
echo -e "Address is $ADDRESS1 $ADDRESS2"
if [ -z "$ADDRESS1" ]
then
#Move the file with the Missing addresses to the Missing Address folder and make an note in its csv.
echo "Copying file to the folder called Missing_Addresses"
cp "$f" "$OUTPUTFOLDER"/Missing_Addresses/
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
else
# 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/Addresses/Addresses.csv
cp "$f" $OUTPUTFOLDER/Addresses/
echo "Copying file to the folder called Addresses"
fi
done
echo "All Done!" You can find all the Files in $OUTPUTFOLDER!"
echo " "
echo " "
exit
+9 -1
View File
@@ -1,3 +1,11 @@
# EOY PDF Sortandmerge # EOY PDF Sort & Merge
## Prerequisite
1. Linux for Windows Subsystem (WSL2)
2. Ubuntu installed from Windows Store
To start make sure all files are downloaded and in the same directory. Then run the application.
./Run.sh
Project to sort, filter, and merge pdf files. Project to sort, filter, and merge pdf files.
+68
View File
@@ -0,0 +1,68 @@
#!/bin/bash
#Get the folder with the pdf documents in it.
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
#Get the folder for the output file.
while :
do
echo -e "What is the output directory for the pdf's with missing addresses?"
#read OUTPUTFOLDER
OUTPUTFOLDER="/home/btmccrea/Downloads/output/Final"
if [ -d $OUTPUTFOLDER ]
then
break
else
echo -e "Directory not found."
fi
done
#Get the folder with the csv
while :
do
echo -e "What path and file with?"
#read CSVFILE
if [ -f $CSVFILE ]
then
break
else
echo -e "File not found."
fi
done
#import list from csv
echo "Processing csv."
while IFS=$'\t' read -r FILE
do
echo "FILE $FILE"
# echo "user $USER"
# echo "match $MATCH"
# echo "${array[0]}"
# if [[ "$MATCH" == "Match-Mailable" ]]
# then
#
# echo -e "Processing file $FILE"lY
cp $PDFDIR/"$FILE" $OUTPUTFOLDER
# else
# echo "no match"
# fi
done < /home/btmccrea/Downloads/Smarty_Streets.csv
#FILE=$(cat /home/btmccrea/Downloads/Smarty_Streets.csv)
#echo $FILE
#IFS=$'\t'
#for f in Smarty_Streets.csv
#do
# echo "doing file $f"
# cp $PDFDIR/"$f" $OUTPUTFOLDER
#done
#cd to and then remove files
+94
View File
@@ -0,0 +1,94 @@
echo "Welcome! It must be the start of a new year! In order to get started with sorting and merging the PDF documents I need to know a little more information."
echo
echo
read -p 'Where is the directory that has the PDF statments with address? ' PDFDIR
#read PDFDIR
#Get the folder for the output file.
echo
read -p 'What output directory do you want for the sorted PDFs? ' OUTPUTFOLDER
#read OUTPUTFOLDER
echo
echo "The PDFs statments are in $PDFDIR?"
echo "The output folder will be $OUTPUTFOLDER."
echo
read -p "Press Enter to continue" </dev/tty
echo
#./Find_Missing_Addresses.sh $PDFDIR $OUTPUTFOLDER
#Create the csv and headers for the Addresses. It is tab separated.
mkdir $OUTPUTFOLDER/Addresses
touch $OUTPUTFOLDER/Addresses/Addresses.csv
echo -e "File,User,Street,City,State,Zip" > $OUTPUTFOLDER/Addresses/Addresses.csv
#Create csv with all the files with missing addresses
mkdir $OUTPUTFOLDER/Missing_Addresses
touch $OUTPUTFOLDER/Missing_Addresses/Missing_Addresses.csv
echo -e "File\tUser" > $OUTPUTFOLDER/Missing_Addresses/Missing_Addresses.csv
cd $PDFDIR
#FOLDER=$(ls | grep *.pdf)
#echo $FOLDER
#*.pdf represensts All files in the current directory with a pdf extention.
for f in $PDFDIR/*
do
echo "Processing file $f."
#pdftotext converst the file to text and places it in the file name temp
pdftotext "$f" - > TEMP
#assigns the lines with relevant values to their variable
USER=$(sed -n '12p' TEMP)
ADDRESS1=$(sed -n '13p' TEMP)
ADDRESS2=$(sed -n '14p' TEMP)
echo -e "User is $USER"
echo -e "Address is $ADDRESS1 $ADDRESS2"
if [ -z "$ADDRESS1" ]
then
#Move the file with the Missing addresses to the Missing Address folder and make an note in its csv.
echo "Copying file to the folder called Missing_Addresses"
cp "$f" "$OUTPUTFOLDER"/Missing_Addresses/
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
else
# 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/Addresses/Addresses.csv
cp "$f" $OUTPUTFOLDER/Addresses/
echo "Copying file to the folder called Addresses"
fi
done
echo "All done sorting! You can find all the Files in $OUTPUTFOLDER!"
echo
echo
read -r -p "Do you want to continue? [Y/n]" response
response=${response,,} # tolower
if [[ $response =~ ^(y| ) ]] || [[ -z $response ]]; then
cd $PDFDIR
for FILENAME in $PDFDIR/*
do
echo $FILENAME
#The next Line assigns the number of pages to the value LOCATION to be used for were the file goes
LOCATION=$(pdfinfo "$FILENAME" | grep Pages: | awk '{print $2}')
#Test if the file exists and if it does move it to Temp.pdf to be merged back to its original location.
if test -f $OUTPUTFOLDER/Statement-Pages-$LOCATION.pdf
then
mv $OUTPUTFOLDER/Statement-Pages-$LOCATION.pdf $OUTPUTFOLDER/temp.pdf
pdfunite "$FILENAME" $OUTPUTFOLDER/temp.pdf $OUTPUTFOLDER/Statement-Pages-$LOCATION.pdf
else
#IF the file doesn't exist create the file with the merge.
pdfunite "$FILENAME" $OUTPUTFOLDER/Statement-Pages-$LOCATION.pdf
fi
done
echo
echo
echo "All done, you can find the PDF statments at $OUTPUTFOLDER."
echo
echo
exit
+62
View File
@@ -0,0 +1,62 @@
#!/bin/bash
#get directory for pdf files
#get output directory for files
#Get the folder with the pdf documents in it.
#echo "This will take the PDF statements that have been sorted and will merge them into PDF files based on the numbers of pages in the statement."
#echo ""
#echo "Before we begin we need a little information."
#echo ""
#while :
#do
# echo "Where is the directory that has the PDF statments with address?"
# read PDFDIR
# if [ -d $PDFDIR ]
# then
# break
# else
# echo "Directory not found."
# fi
#done
#Get the folder for the output file.
#while :
#do
# echo ""
# echo "What output directory do you want for the sorted PDF's?"
# read OUTPUTFOLDER
# #OUTPUTFOLDER="/home/btmccrea/Downloads/output"
# if [ -d $OUTPUTFOLDER ]
# then
# break
# else
# echo "Directory not found."
# fi
#done
cd $PDFDIR
for FILENAME in $PDFDIR/*
do
echo $FILENAME
#The next Line assigns the number of pages to the value LOCATION to be used for were the file goes
LOCATION=$(pdfinfo "$FILENAME" | grep Pages: | awk '{print $2}')
#Test if the file exists and if it does move it to Temp.pdf to be merged back to its original location.
if test -f $OUTPUTFOLDER/Statement-Pages-$LOCATION.pdf
then
mv $OUTPUTFOLDER/Statement-Pages-$LOCATION.pdf $OUTPUTFOLDER/temp.pdf
pdfunite "$FILENAME" $OUTPUTFOLDER/temp.pdf $OUTPUTFOLDER/Statement-Pages-$LOCATION.pdf
else
#IF the file doesn't exist create the file with the merge.
pdfunite "$FILENAME" $OUTPUTFOLDER/Statement-Pages-$LOCATION.pdf
fi
done
echo ""
echo ""
echo "All done, you can find the PDF statments at $OUTPUTFOLDER.
echo ""
echo ""
exit