Moderator: Mr_Noodle
path=`dirname "$1"`
/usr/bin/mdimport -d2 "$1" >& "$path"/"_extract.txt"
x=`egrep -o 'Closing Date ..\/..\/..' "$path"/"_extract.txt" | awk '{print $3}'`
rm -rf "$path"/"_extract.txt"
m=`echo $x | awk -F'/' '{print $1}'`
d=`echo $x | awk -F'/' '{print $2}'`
y=`echo $x | awk -F'/' '{print $3}' | awk '{print "20"$1}'`
touch -t "$y$m$d"0000 "$1"
mv "$1" "$path"/"$m-$d.pdf"
exit 0
Mr_Noodle wrote:I suggest trying some of the individual parts of the script on the commandline. I'm guessing the egrep is failing.
Users browsing this forum: No registered users and 1 guest