Hi All,
Let's say I have a C file such as follows:
Code:
#include <stdio.h>
#if DEFINED
#define EFG 1
int foo()
{
return 0;
}
// comment here
/* comment here */
#elif _NOT_DEFINED
#define ABC 0
int boo()
{
return 0;
}
#else
void zoo()
{
// nothing here
}
#endif
int main()
{
return 0;
}
Using
sed (or any other widely used scripting tool), I want to modify the C file to look something like this:
Code:
#include <stdio.h>
#if DEFINED
#define EFG 1
int foo()
{
return 0;
}
// comment here
/* comment here */
#endif
int main()
{
return 0;
}
Basically, I want to remove the code that falls under _NOT_DEFINED or else blocks (equivalent of #if 0 blocks). Any ideas?
Thanks in advance.