regex - sed problem. What am I doing wrong? -
i trying replace a[ 'xxx' ] a[ xxx ] using sed:
sed -e 's/a[ '\(.*\)' ]/a[ \1 ]/' ./test sed: -e expression #1, char xx: invalid reference \1 on `s' command's rhs
what doing wrong?
thanks!
you need escape [
, ]
this:
echo "a[ 'xxx' ]" | sed "s/a\[ '\(.*\)' \]/a[ \1 ]/"
Comments
Post a Comment