I have input file called file1 with characters that have \\ in it.
I cannot change input file, because it is generated earlier in script.
Now would like to replace string on line in file called bfile with output from file1
I have been using sed command.
You should use another character as a delimiter in sed command:
sed -e "s%State%$BC%g" bfile
instead of:
sed -e "s/State/$BC/g" bfile
for example... You may choose a character that is not in the file whose contents is to be changed, though; in fact, this is the explanation of the error message that you include in your request.
Yes, that worked!
Thank you hexram!
I thought I was going to have to write a sub routine to analyze file1 character by character.
I not sure what other delimiter I could use? Ok read man page. "Any character other than backslash or newline can be used instead of a slash to delimit the RE and the replacement."
I will change code to look at output from generated file1 and make changes to sed command, if file1 has /, %, $, etc.... in it.