jrram
asked on
Does SED support alternation regular expression?
Hello,
Here is an example of my data:
<frame context=".*/batch">
</frame>
<frame context=".*/continuous">
</frame>
========================== ======
I am trying convert the above data to look like:
<frame>
</frame>
<frame>
</frame>
========================== ======
I currently have these two sed scripts that do the job, but I am trying to combine into one statement:
sed -i "/<frame /,/>/ s/ context=\"\.\*\/batch\"//g " $PRODUCTDIR/kb/framesPTP.x ml
sed -i "/<frame /,/>/ s/ context=\"\.\*\/continuous \"//g" $PRODUCTDIR/kb/framesPTP.x ml
I tried:
sed -i "/<frame /,/>/ s/ context=\"\.\*\/(batch|con tinuous)\" //g" $PRODUCTDIR/kb/framesPTP.x ml
But it does not work for me. When I use the pipe to get the either/or it doesn't do any substitution at all. Help please.
Here is an example of my data:
<frame context=".*/batch">
</frame>
<frame context=".*/continuous">
</frame>
==========================
I am trying convert the above data to look like:
<frame>
</frame>
<frame>
</frame>
==========================
I currently have these two sed scripts that do the job, but I am trying to combine into one statement:
sed -i "/<frame /,/>/ s/ context=\"\.\*\/batch\"//g
sed -i "/<frame /,/>/ s/ context=\"\.\*\/continuous
I tried:
sed -i "/<frame /,/>/ s/ context=\"\.\*\/(batch|con
But it does not work for me. When I use the pipe to get the either/or it doesn't do any substitution at all. Help please.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I am unable to test that here but I don't see the issue with the alternation.
Thanks for the question and the points.
ASKER