I am under the gun on a project and am not very good at scripting. I have to make a modification to thousands of C programs to basically replace the #pragma statement. I don't want to have to do it manually. Here is an example of what I need done. Any help would be greatly appreciated.
I have a number of C programs that have the following 2 scenarios
Scenario 1
First line of C program is
#pragma ident "@(#)program1.sc 1.1 03/11/09 XXXXX"
(always the 1st line of the program)
Scenario 2
First 3 lines of C program are
#ifndef WIN32
#pragma ident "@(#)program2.sc 1.3 06/11/09 EDS_dsct"
#endif
(always the 1st 3 lines of the program)
Final result
Depending on whether I have scenario 1 or scenario 2. I need to replace both scenarios with
#pragma ident "%W% %G% %Q%"
For scenario 1, I just need to replace one line for one line.
For scenario 2, I need to replace 3 lines with one line. I only need to replace the ifndef/endif in the 1st 3 lines. If there are other ifndef/endif statements in the program, they still need to remain.
Once again. Thanks for you help and it is greatly appreciated.
thanks.