How to reference captures in bash regex replacement -
how can include regex match in replacement expression in bash?
non-working example:
#!/bin/bash name=joshua echo ${name//[oa]/x\1} i expect output jxoshuxa \1 being replaced matched character.
this doesn't work though , outputs jx1shux1 instead.
bash> name=joshua bash> echo $name | sed 's/\([oa]\)/x\1/g' jxoshuxa
Comments
Post a Comment