This is similar to
Linux GREP/SED [xargs] find pattern and line number in files and remove with SED
How to change all occurrences of a word in all files in a directory
but I am having problems applying these with \n.
I am trying to remove all comments (// and /**/) and all newline characters, then insert a newline after each } and }; from a function. I also need precompiler directives to be ignored.
This is all to the ends that each include, define, struct, and function to be on its own line for some aggregation into a single file.–I’m refactoring a large project.
There’s a very useful program called
indent, it’s used to automagically indent C source code. Download it, read its man page and check what it can do. It may solve your problem…