using the sed command with variable subsitution???

how much do you know on using the sed commands within a diff command? I'm currently using one long command when robot runs that... when the diff command is ran that the < and > signs at the beginning of each line are changed to the environment name that they came from... making it easier to review...

diff $e1file $e2file | sed -e 's/^</$e1nm /1' -e 's/^>/$e2nm /1' > $dfnm

the variables above are... e1file is first file; e2file is the second environment code file; ^< will give me the < sign that is in the first position on a line; e1nm is subsitution value for first file;
e2nm is subsitution value for first file; dfnm is the name of the resulting diff file

The problem I'm having with this is that the subsitution part wants to change the < sign to "$e1nm" and not to say "file1" ... do anyone know how I can get a variable subsitution to work in this diff/sed command?

found it...

I was using the single quote (') instead of the double quote (")....

diff $e1file $e2file | sed -e "s/^</$e1nm /1" -e "s/^>/$e2nm /1" > $dfnm

Thanks!
Harold

Thanks for posting your solution... I wish more folks would follow your example... Or reply at least saying that their problem was resolved or unresolved.

Many do but many more do not...