[已解决]"sed 's/abc/\1/'"提示"invalid reference \1",啥问题?
发表于 : 2016-10-15 2:11
"sed 's/abc/\1/'"提示"invalid reference \1",啥问题?貌似并无网传的转义错误
网上搜都说是什么什么东西忘了转义了
但我这个这么简单的,貌似没什么忘记转义的吧?
网上搜都说是什么什么东西忘了转义了
但我这个这么简单的,貌似没什么忘记转义的吧?
致力于Ubuntu中文推广
http://forum.ubuntu.org.cn/
代码: 全选
$ sed --version
sed (GNU sed) 4.2.2
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Jay Fenlason, Tom Lord, Ken Pizzini,
and Paolo Bonzini.
GNU sed home page: <http://www.gnu.org/software/sed/>.
General help using GNU software: <http://www.gnu.org/gethelp/>.
E-mail bug reports to: <[email protected]>.
Be sure to include the word ``sed'' somewhere in the ``Subject:'' field.
代码: 全选
$ echo 'aaaXXXaaa' | sed 's/XXX/\1/'
sed: -e expression #1, char 9: invalid reference \1 on `s' command's RHS
$ echo 'aaaXXXaaa' | sed 's/XXX/\\1/'
aaa\1aaa