hello everyone!
I need to fix some things in a piece of generated code. I think it has
to be done with awk, as its a multi line thing, for which sed seems to
be bad. I have to replace some values in functions, according to the
function name. so basically i have the generated code file
(simplifyed):
[code]
blabla Name_2 blabla {
aaaa
bbbb
cccc
blabla Value blabla
dddd
}
blabla Name_1 blabla {
tttt
wwww
ssss
cccc
blabla Value blabla
ssss
blabla Name_3 blabla {
xxxx
qqqq
blabla Value blabla
llll
}
[/code]
and a substitution map somehow like this (doesnt have ot be in this
form, as i have to write it manually anyway):
[code]
Name_1 Value_x
Name_2 Value_z
Name_3 Value_y
[/code]
The first appearance of Value that comes after Name_1 has to be
changed to read Value_x and so forth. It could be done with one awk
invocation for each substitution, that would not be a problem, as it
are only about 8 of them. The thing is, i have newer used awk (except
copy and paste).
thanks :-)


|