>>95
GNU sed を使うという手もある。

例)
$ echo 'abcdef' | sed 's/a\(b\)c\(de\)f/x\1y\2z/'
xbydez