regex - sed error "Invalid range end" -
i run substitution command on ubuntu 12.04.
$ sed -e "s/([a-za-z0-9.-/\\ :]+)/\1/g"
however, following error raised.
sed: -e expression #1, char 27: invalid range end
i can remember same expression works on macosx.
can describe why command fails?
you can solve in 2 ways. 1 of them use -r
switch avoid escaping special characters , move -
in range first or last position , avoid special meaning, like:
sed -re "s/([a-za-z0-9./\\ :-]+)/\1/g"
otherwise need escape either (
, )
, +
, like:
sed -e "s/\([a-za-z0-9./\\ :-]\+\)/\1/g"
Comments
Post a Comment