Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SED problem 1

Status
Not open for further replies.

Rigsby1

MIS
Jan 21, 2003
2
GB
Hello All,

I cannot for the life of me remember how to do the following is SED:

OLD_STRING="MAIN_CE MSG_OUTPUT /ctsa/controlsa/logs/CE_MSG.%s"
NEW_STRING="MAIN_CE MSG_OUTPUT /ctsa/controlsa/logs/CE_MSG.##G1##.%s.log"

echo "Changing the MAIN_CS paramater to enable log rotation"
sed "s/${OLD_STRING}/${NEW_STRING}/g" ${CTSPARM} > ${CTSPARM}.work

In this script the old new and old strings contain / various other characters which seem to be being interpreted as pattern seperators, thus causing an error in SED. Does anyone know how to replace the old string with the new string in this instance?

Many Thanks for you help




 
Hi,

Try to replace / with ! (for example, or any other character which is not in the pattern):
sed "s!${OLD_STRING}!${NEW_STRING}!g"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top