Replace two characters using one sed command

echo "A=[A]" | sed s'/[]=]/ /g'

A [A


You can use the '-e' flag to execute multiple substitutes, for example:

# echo "A = [A]" | sed -e 's/=//' -e 's/]//'
A  [A

It might be possible to match both '=' and ']' in a single substitute but even if it is, I don't think it'll provide much benefit over using '-e'.


It's probably easier to use tr to do something like this as it doesn't involve messing with REs

echo "A=[A]<-" | tr "]=" " "
A [A <-