#!/bin/bash
#created by Kris Occhipinti
#http://filmsbykris.com
#reads and splits data from Driver's Licenes Swiper
#March 11th 2014
#more info on DL data: http://dcm.uhcl.edu/caps7g8/Drivers%20License.pdf
:<<'info'
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
info
clear
echo "Welcome"
while [ 1 ]
do
echo "Please Swipe Your Card (Enter to Exit):"
read data
if [ "$data" = "" ]
then
echo "Exiting"
exit 0
fi
clear
num="$(echo "$data"|sed 's/63601015//g'|cut -d\; -f2|cut -d\= -f1)"
name="$(echo "$data"|cut -d\^ -f2)"
lname="$(echo "$name"|cut -d\$ -f1)"
fname="$(echo "$name"|cut -d\$ -f2)"
mname="$(echo "$name"|cut -d\$ -f3)"
address="$(echo "$data"|cut -d\^ -f3|cut -d\? -f1)"
zip="$(echo "$data"|cut -d\! -f2|awk '{print $1}')"
sc="$(echo "$data"|cut -d\% -f2|cut -d\^ -f1)"
state="${sc:0:2}"
city="${sc:2:10}"
dob="$(echo "$data"|cut -d\= -f2)"
doby="${dob:4:4}"
let dobm="${dob:9:1}"
let dobm+=1
dobd="${dob:10:2}"
exdate="$(echo "$data"|cut -d\= -f2)"
exdate="${exdate:2:2}/${exdate:0:2}"
echo "Driver's License Number: $num"
echo "Card Holder: $fname $mname $lname"
echo "DOB: $doby-$dobm-$dobd"
echo "Address: "
echo "$address"
echo "$city, $state $zip"
echo "Experation Date: $exdate"
echo "----------------------------"
done