I have a C input file (myfile.c) that looks like this:
void func_foo();
void func_bar();
I want to use the shell command to insert new function prototypes, so the output will look like this:
void func_foo();
void func_bar();
void func_new();
So far I have not used SED or PERL. What did not work out:
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 templates with perl -pe "....." does not work either.
What am I missing? I tried many different approaches, including this and this and that .
source
share