I have an input C file (myfile.c) that looks like this :
void func_foo();
void func_bar();
//supercrazytag
I want to use a shell command to insert new function prototypes, such that the output becomes:
void func_foo();
void func_bar();
void func_new();
//supercrazytag
So far I've been unsuccessful using SED or PERL. What didn't work:
sed 's|\n\n//supercrazytag|void func_new();\n\n//supercrazytag|g' < myfile.c
sed 's|(\n\n//supercrazytag)|void func_new();\1|g' < myfile.c
Using the same patterns with perl -pe "....." didn't work either.
What am I missing ? I've tried many different approaches, including this and this and that.