This should be straight-forward, but I cannot figure it out. If I want to replace an A or B with a C using sed the code could potentially be:
$ echo AAXXAAYYBB | sed 's/[AB]/C/g' CCXXCCYYCC
This results in all A's and B's converted to C's.
What I'd like to do is replace "A" with either one of two (or potentially more) variables:
Output (where the substitution of B or C is random):
But this code will only change A's to...
$ echo AAXXAAYYBB | sed 's/A/[BC]/g' [BC][BC]XX[BC][BC]YYBB
I'm trying to avoid PERL here if possible. Does anyone have an idea how to fix this?