When chaining multiple commands with a g// search, GNU ed stops at the first 'a', 'i', or 'c' and does not execute any commands after it. It does not even examine them for syntax errors. The ed implementation supplied with Mac OS X Leopard executes as expected, see the example below.
Note that in the second command, ed in OS X performs the command on one matched line before stopping due to the syntax error. This is probably not expected either, ed should not do anything if there is a syntax error. But this behaviour is better than not reporting the error at all and silently succeeding. GNU ed: $ ed H P *a foobar foobaz . *g/foo/a\ spam\ .\ p *# nothing printed here, contrast with OS X *g/foo/a\ eggs\ .\ nonexistentcommand *# no error printed here *1,$p foobar eggs spam foobaz eggs spam *# command done instead of stopping due to syntax error Mac OS X Leopard: $ ed H P *a foobar foobaz . *g/foo/a\ spam\ .\ p spam spam *g/foo/a\ eggs\ .\ nonexistentcommand ? invalid command suffix *1,$p foobar eggs spam foobaz spam * _______________________________________________ bug-ed mailing list bug-ed@gnu.org http://lists.gnu.org/mailman/listinfo/bug-ed