Escape < and > in sed/shell
quoting, sed, shell
Solution
Ok. Found out by myself. Use quotes.
$ sed -i "s/>foo</>bar</g" file
Problem
How do I escape '<' and '>' character in sed. I have some xml files which needs some text between the tags to be replaced. How do I escape the '>' and '<' characters. The problem with > and < is it has special meaning in the shell to redirect the output to a file. So backslash doesn't work.