Your first "echo" needs to be in single quotes or else it results in...
29912:oracle@mybox> echo "123$45$678" 123578 Once that is done this... 29912:oracle@mybox> echo '123$45$678' | sed 's/\$/\\$/g' 123\$45\$678 ...or this... 29912:oracle@mybox> echo '123$45$678' | sed 's/\$/\\\$/g' 123\$45\$678 ...will work "Guang Mei" <[EMAIL PROTECTED] To: Multiple recipients of list ORACLE-L <[EMAIL PROTECTED]> m> cc: Sent by: Subject: OT: unix script quetion: to replace $ with \$ [EMAIL PROTECTED] 02/03/03 11:39 AM Please respond to ORACLE-L Hi: I have a quick question about replacing "$" with "\$" on unix. I need to convert string "123$45$678" to "123\$45\$678" through a pipe. I tried with sed command, but could not get it to work: essex$ echo "123$45$678" | sed s/"$"/"\$"/g 123578$ essex$ echo "123$45$678" | sed s/"$"/"\\$"/g 123578$ Maybe there is another syntax that I should use? TIA. Guang Mei _________________________________________________________________ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Guang Mei INET: [EMAIL PROTECTED] Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: INET: [EMAIL PROTECTED] Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).