Not GNU sed. I have a collection of makefiles I'm trying to uniformly modify. In each makefile, I have a comment that tells me where to put the code.
sed "/MULTI WORD COMMENT/a\
LINE 1\
LINE 2 $stuff $morestuff" "$file" >> "$file"_NEW
I want to find the comment, then append multiple lines of text after it. Some lines contain shell variables I want to expand. All I could figure out is that I need to use "
when I want to do shell expansions and that each line to be appended should get its own line.
I get an error telling me to terminate the "a" command with "\", but it looks like I'm already doing that. What am I doing wrong?
Example input
# MULTI WORD COMMENT
.SUFFIXES: .o .c
Example output
# MULTI WORD COMMENT
LINE 1
LINE 2 ASDF GASIFJ
.SUFFIXES: .o .c
In this case, stuff=ASDF
and morestuff=GASIFJ
. These are not entirely unlike the variable names in the makefiles I'm working with.