Reading text file, comparing a value in a line, and placing only part of the line in a variable?

I need some help. I would like to read in a text file.

Take a variable such as ROW-D-01, compare it to what's in one line in the text file such as PROD/VM/ROW-D-01 and only input PROD/VM into a variable without the /ROW-D-01.

Is this possible? any help is appreciated.

Do I understand you correctly that you want the entire text file (= ALL lines), with ROW-D-01 removed, assigned to one variable? How many lines does your file consist of? Post a sample input file.

var1="ROW-D-01"
var2=`sed -n 's/\/'"$var1"'$//p' textfile`

or

var1="ROW-D-01"
var2=$(while read line; do [ "$(basename "$line")" = "ROW-D-01" ] && dirname "$line"; done <textfile)