Hey catkin
I am sure you are probably getting sick of me

But I had another crack at this ( and made some quite different changes I thought might interest you.
Also, I stripped yours out and threw it in a script to (as wasn't sure how to run yours as is).
I have attached the output from both yours and my script (only a few discrepancies as yours seemed
to handle remarks as blank lines) and also your script as i was running it (as I said this could be wrong
way to do it) and mine is below in case you were interested
Cheers again for the challenge (although I would love to see how someone like ghostdog would do it,
probably a couple of one-liners <hehe>)
Code:
#!/usr/bin/awk -f
BEGIN {
FS="[ \t]*=[ \t]*"
f = 1
g = 1
cnt = 0
value_arr_cnt = 0
}
$0 !~ /{|}/ && $0 !~ FS{ next }
{
gsub(/^[ \t]+|#.*$/,"", $1)
gsub(/[ \t]+$/, "", $1)
key_org = "'"$1"'"
gsub(/[ \t]+/,"", $1)
key = tolower($1)
}
$2 ~ /#/ && index($2, "\"") > index($2, "#"){ f = 0 }
f && $2 ~ /".*"/{
split($2, value, "\"")
for (c in value)value_arr_cnt++
for (x in value){
gsub(/\\\\/, "SAVE", value[x])
if (value[x] ~ /\\$/)
gsub(/\\/, "\"", value[x])
if (x % 2 == 1){
gsub(/^[ \t]+|[ \t]+$/, "", value[x])
if (value[x] ~ /^#.*/)
for (y = x; y <= value_arr_cnt; y++)
delete value[y]
}
if (value[x] ~ /"/ && value[x+1] != "")
value[x+1] = value[x] value[x+1]
gsub(/\\+/, "", value[x])
gsub("SAVE", "\\", value[x])
}
g = 0
value_arr_cnt = 0
}
g{
gsub(/[ \t\"\\]+|#.*$/,"",$2)
value[1] = $2
}
{
print "keyword_org="key_org
print "keyword="key
for (x in value){
if ( value[x] != "\"" && value[x] != "")
print "conf_values["cnt++"]='"value[x]"'"
}
delete value
f = 1
g = 1
}