g/foo/a\
 append1 \
 append2 \
.
w
