Need solution to Sed problem. Want to match "&" but not "&"

view story

http://www.linuxquestions.org – I want to used sed or some other linux command to convert special characters in XML files. Here is an example: -bash-3.2$ echo "P&G" P&G Now I want to change the "&" to "&" so I run: -bash-3.2$ echo "P&G" | sed -e "s/&/&/ig" P&G I got the result I want, but if someone runs the conversion program again, the output files get messed up. Here is an example: -bash-3.2$ echo "P&G" | sed -e "s/&/&/ig" | sed -e "s/&/&/ig" P&G Is there (HowTos)