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

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -