Sed Dua Pola

sed 's/ab/~~/g; s/bc/ab/g; s/~~/bc/g'
Smoggy Seal