Frequent Advisor
Script help. Perl perhaps ?
Hi.
I have written the script below to do a simple lookup but now I need to do it on a much larger datafile and it will take an age.
I suspect perl is the way to go to make it faster, but I don't know any perl :(

Could someone help me to translate this script please to save my server days of processing?
Thanks in advance.

The script looks up each line of a data file, compares certain fields with fields from a master file, and outputs an id value from the master file along with certain fields from the data file.

masterfile=/tmp/masterfile
datafile=/tmp/datafile

for b in `cat $datafile`
do

compare=`echo $b | awk 'BEGIN{FS="|"}{data = $2$5$6;print data}END{}' `

for a in `cat $masterfile`
do
mastercompare=`echo $a | awk 'BEGIN{FS="|"}{line = $2$5$6;print line}END{}'`
if [ $mastercompare = $compare ]
then
id=`echo $a | awk 'BEGIN{FS="|"}{print $1}END{}'`
output=`echo $b | awk 'BEGIN{FS="|";OFS="|"}{print $3,$7}END{}'`
echo $id"|"$output >> luke.out
fi
done

done