Multiple varibles in file

Working on a way to speed up my script output. I have a multiline file that I pull each line as a variable and post it on a webpage. It needs some help as it works but slow. I think I have too many cat, grep and sed going on but don't know what would work better.

#!/bin/sh
FILE=/export/htdocs/request/$REQUEST
DATE=`cat $FILE | grep "DATE=" | sed -n 's/.*=//p'`
NAME=`cat $FILE | grep "NAME=" | sed -n 's/.*=//p'`
EMAIL=`cat $FILE | grep "EMAIL=" | sed -n 's/.*=//p'`
PHONE=`cat $FILE | grep "PHONE=" | sed -n 's/.*=//p'`
UID=`cat $FILE | grep "UID=" | sed -n 's/.*=//p'`
COMPANY=`cat $FILE | grep "COMPANY=" | sed -n 's/.*=//p'`
OC=`cat $FILE | grep "OC=" | sed -n 's/.*=//p'`
PRIORITY=`cat $FILE | grep "PRIORITY=" | sed -n 's/.*=//p'`
EXPLAIN=`cat $FILE | grep "EXPLAIN=" | sed -n 's/.*=//p'`
JUSTIFICATION=`cat $FILE | grep "JUSTIFICATION=" | sed -n 's/.*=//p'`
COMMENTS=`cat $FILE | grep "COMMENTS=" | sed -n 's/.*=//p'`
REGION=`cat $FILE | grep "REGION=" | sed -n 's/.*=//p'`
ADD_DELETE=`cat $FILE | grep "ADD_DELETE=" | sed -n 's/.*=//p'`
FILTER=`cat $FILE | grep "FILTER=" | sed -n 's/.*=//p'`
TYPE=`cat $FILE | grep "TYPE=" | sed -n 's/.*=//p'`
SOURCE_IP=`cat $FILE | grep "SOURCE_IP=" | sed -n 's/.*=//p'`
PORT=`cat $FILE | grep "PORT=" | sed -n 's/.*=//p'`
STATUS=`cat $FILE | grep "STATUS=" | sed -n 's/.*=//p'`

Here is a sample file it is pulling from

NAME=John Smith
EMAIL=jsmith@testmail.com
PHONE=212-555-1212
UID=gg1234
COMPANY=OTHER
OC=ABC Company
REGION=All
ADD_DELETE=Add
FILTER=Mail
SERVICE_TYPE=TCP
SOURCE_IP=10.1.1.1
PORT=25
REGION=All
ADD_DELETE=Delete
FILTER=Router Access
SERVICE_TYPE=TCP
SOURCE_IP=192.168.1.0/24
PORT=23
PRIORITY=Normal
EXPLAIN=This is an example explanation
JUSTIFICATION=Business justification description
COMMENTS=No comments
DATE=05/23/2010
STATUS=Pending

Hi
Try this:

awk -F"=" '/NAME/{print $2}' $FILE

Guru.

#!/bin/sh

while IFS== read -r name value; do
    case $name in
        FILE|DATE|NAME|EMAIL|PHONE|UID|COMPANY|\
        OC|PRIORITY|EXPLAIN|JUSTIFICATION|\
        COMMENTS|REGION|ADD_DELETE|FILTER|\
        TYPE|SOURCE_IP|PORT|STATUS)
            eval curval=\$$name
            if [ "$curval" ]; then
                value=$(printf '%s\n%s' "$curval" "$value")
            fi
            eval $name=\$value
    esac
done < "$1"

Regards,
Alister

Alister, your solution works perfectly. Thank you very much!

Could make the input file executable, then run it within the current shell.

. ./filename

Hey, methyl:

Whitespace in the values precludes simple sourcing (and if quotes are allowed to appear in values, properly escaping whitespace would be a pain).

Multiple assignment to the same name also stand in the way of simple sourcing. PORT, SOURCE_IP, and a couple of others occur more than once, and the original code accumulates the values, instead of overwritting.

Cheers,
Alister