I'm confused, some words must be missing! Copy where for what? Do you want to preprocess it to include the include files in a temp file with no includes, like cpp or cc -E?
What I meant was while parsing the file, it should find all the places where there is an include statement and whatever is there in the include statement, I should be able to copy that file somewhere, may be temp. The include statement always has a path to a file.
It executes the sed statement correctly but puts an '=' sign before so when the cp command is executed it fails because it has an '=' sign also
It says "cannot open (=)
---------- Post updated at 05:58 PM ---------- Previous update was at 05:57 PM ----------
Well, I'm at a loss, I don't believe anything in the awk script is non POSIX. Perhaps your awk is fairly old. What OS are you on? Is gawk throwing the same error?
I suspect you created the file on windows (eg with notepad) and then copied it to linux. Try dos2unix cpinclude on your linux platform, this should sort things out (windows puts extra \r on the end of each line and this isn't compatable with linux.
This could also be why the scripts offered by others here haven't worked out for you.
@chubler: You are right, dos2unix worked and the script does work now. I did create on the windows side for this one. Not for the other ones though. They still seem to have the problem. Thanks Bud.
One thing I found in my conditions are that the include statements can have statements as below which seems to crap out.
.include '/net/proj/1.txt' section
It says "unexpected EOF while looking for matching ' "
Also, I might have include statements within the file that is copied from the first include statement. May be I am asking for too much