shell script problem

Hey there,

I`m a beginner so don`t be brutall with me if it`s a stupid or easy question.

I need to make a script that
1) reads from a text file with this pattern:

2) and i need it to insert the #defines in the .c files

Problem is, that i`m working in a batch file,from within Windows, but with cygwin installed(so i have most of the UNIX commands, including SED), but i can`t insert "while" or "for" loops.

So, any ideas how to do this without those loops?

I really would appreciat the help

i can't understan why you doesn't has "while" or "for", sometimes i use cygwin and i don't have this problem.
The only idea is yo filter all "#define" lines in a new file and then use comand cat to concatenate with the other file, something like this:

    grep "#define" FileDefine > NewFile
    cat NewFile  C_File > New_C_File

i can`t use "while" or "for" because the statements that i am using, are within a Batch file.

I figured out how to get the "#define var value" part using sed, problem is that i don`t know how to get the file names and open them.
and i put for every file i go through, the #defines in a temporary define.txt.

I tryed something like:

 
awk '{ cat $1 define.txt > $1}'

but it dosen`t work. Any ideas how can i parse the file names one by one?

ok now i understand you, sorry.Probe this:

$ ls -l
total 16
-rw-r-----   1 ubatch     ubatch          89 20 Ago 18:45 file

$ more file
first.c #define var 1 #define other_var2
sedond.c #define a_var 1 #define another_var2

$ awk '{ file=$1;$1="";print $0 >> file}' file
$ ls -l
total 48
-rw-r-----   1 ubatch     ubatch          89 20 Ago 18:45 file
-rw-r-----   1 ubatch     ubatch          34 20 Ago 18:46 first.c
-rw-r-----   1 ubatch     ubatch          38 20 Ago 18:46 sedond.c

$ cat f*.c
 #define var 1 #define other_var2
$ cat s*.c
 #define a_var 1 #define another_var2
$