On Sun, 25 Dec 2022, Ralph Corderoy wrote:

It's the first expression which is the problem.

   $ sed -e 's%[[./*$^\\]%\\&%g' </dev/null
   sed: -e expression #1, char 18: unterminated `s' command
   $ sed -e 's%.*%/^&:/d%' </dev/null
   $

Thanks for that help. It was way beyond my 'sed' skill level.

It's because ?[? represents itself inside a character class unless it's
followed by a colon, dot, or equals because then it looks like the start
of a ?[:digit:]? or similar.  Re-ordering works:

   $ sed -e 's%[.[/*$^\\]%\&%g' </dev/null

Thanks. That works.  Strange that the buggy one worked for 2 decades.

Regards - Damian

Pacific Engineering Systems International, 277-279 Broadway, Glebe NSW 2037
Ph:+61-2-8571-0847 .. Fx:+61-2-9692-9623 | unsolicited email not wanted here
Views & opinions here are mine and not those of any past or present employer

Reply via email to