regex - sed - $ in Zeichenauswahl -
i have sed
expression replace "$about" "about"
sed 's/$about/"about"/g
i want change it, $about replaced, when followed whitespace or end of line. whitespaces works:
sed 's/\($about\)\([[:space:]]\)/"about"\2/g'
wondefull! end of line? tried inserting $
:
sed 's/\($about\)\([[:space:]$]\)/"about"\2/g'
but not work! \$
not work. when insert $
without [[:space:]], works (but eol, not whitespaces of course).
i missing something, not? please tell me is.
you need use alternation otherwise $
literal $
inside character class:
sed -e 's/($about)([[:space:]]|$)/about\2/g'
Comments
Post a Comment