#!/bin/bash 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 while : do echo -e "What is the output directory for the pdf's with missing addresses?" #read OUTPUTFOLDER OUTPUTFOLDER=/home/btmccrea/Documents/ouput if [ -d $PDFDIR ]; then break else echo -e "Directory not found." fi done FILES=$(ls $PDFDIR) cd $PDFDIR echo $FILES for f in "$FILES" do pdftotext $f - | TEMPFILE ADDRESS=$(awk 'NR == 14 {print ; exit}' TEMPFILE) echo $ADDRESS if [ -z $ADDRESS ]; then cp $f to $OUTPUTFOLDER fi done exit