Reading from a File and Using as an Input variable

I need to know how the the string constant from Input File should be read and provide as input data for the script .


INPUT FILE

CONST        VARIABLE
myname=/root/dir/syslog/myname1
myname=/root/dir/syslog/myname2
myname=/root/dir/syslog/myname3 

urname=/root/dir/syslog/urname1
urname=/root/dir/syslog/urname2
urname=/root/dir/syslog/urname3

........
.........
;;;;;;;

nthname =/root/dir/syslog/ntname1

I would like to read some constant values from the file and feed that as an input to the script, something like this.


./myscript urname

From above syntax, Im just using the Constant String from the input text, but script should perform actions on all the instances of variable string mapped to the constant from input text. Can some one provide me the method how to call this . Do i need to write any functions for this?

something like:

while IFS="=" read $CONST $VARIABLE
do
 ## do whatever with $CONST and $VARIABLE
done < INPUT_FILE

I would add an if statement to operate only on lines containing given parameter:
while IFS="=" read $CONST $VARIABLE
do
if [ "$CONST" = "$1" ]
then
## do whatever with $CONST and $VARIABLE
fi
done < INPUT_FILE

This may not in work in the instance while if offer script to search in those method.

Assume we are talking in term of pointer.

urname ---> /root/dir/syslog/urname1
                  |---> /root/dir/syslog/urname2
                  |---> /root/dir/syslog/urname3

Assume if the above Constant is Pattern of a File, & Variable is the instances of Files, where we want our script to search for the message. So how will this work, when.
The above syntax should read only the constant and redirect the script to search message in all the 3 instances of File. Just like give below.

./myscript message urname

But not like

./myscript message /root/dir/syslog/urname1 or /root/dir/syslog/urname2 or /root/dir/syslog/urname3

So you are not having fixed format? sorry but I am not clear about the requirement.

something like this,

parse_file.pl

#!/usr/bin/perl

while (<>) {
chomp;
if ($i==1) { if (/^\s+\|---\>\s+(\/.*)/){ print "Do whatever with variable",$1,"\n";} else {$i=0;}}
if(/(urname)([^\w]+)(\/.*)/) {
$a=$3;
                if ($2 =~ /---/) { $i=1;print "Do whatever with variable $a","\n"} else { print "Do whatever with variable $3\n"; }
}
}

invocation

perl parese_file.pl inputfile

sorry, perl is not available in my environment to test this. Can you break that code in shell script. For your review, here is an samplescript uploaded, if you can capture the week points and correc the same. I feel there are many number of loop holes , but still unable to sort it out.