I am trying to emulate a replace command which swaps two characters, with a sed script, but the obvious choice:
sed -e 's/a/b/g' -e 's/b/a/g'
does no work. Can you point me how to do it correctly?
If you only want to replace individual characters, not longer strings, use
or the equivalent
If there is any character that does certainly not occur in the input, such as
Alternatively, you can do some tricks with prefixing:
that is: prefix every
If you have a spare character you can do the suggestion of Uwe.
If you really only need to replace a single character and you do not necessarily need
If you don't need