Hello Rob,

Rob Arthan wrote:
I have a script that uses ed to generate C string definitions from nroff output.
It makes essential use of global substitutions with a newline as the 
replacement text, e.g.,

g/^##*/s/#*/\
/

This functionality is no longer available as of version 1.14 of GNU ed. Is there
a work-around for this?

This functionality was removed from GNU ed because inside a global command the meaning of the escaped newline becomes ambiguous. The POSIX standard documents it:

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ed.html

"A line can be split by substituting a <newline> into it. The application shall ensure it escapes the <newline> in the replacement by preceding it by <backslash>. Such substitution cannot be done as part of a g or v command list."

The workaround is to use 'sed' to split a line in this way. I think sed does not have this problem because it does not need a 'global' command.


Best regards,
Antonio.
--
The right to self-determination is not conditional. All peoples have it, including the catalan people.

_______________________________________________
bug-ed mailing list
bug-ed@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-ed

Reply via email to