https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66136
--- Comment #1 from Ed Maste <emaste at freebsd dot org> --- It appears this comes from \n newlines in the replacement pattern - I can partially fix it by using an expression like: sed 's/(define_mode_iterator \([A-Za-z0-9_]*\) \([]\[A-Z0-9 \t]*\)/\ #define BUILTIN_\1(T, N, MAP) \\ \2\ /g' \ that is, putting literal escaped newlines inside the single-quoted sed expression. However, since we're already using awk at the end of the pipeline anyway, the whole thing ought to just be implemented in awk.