csv file to array, match field1, replace in flat file field1 to field2

heh :wink:
try this test.csv:

"other","data"
"hello","byebye"
"hello2","byebye2"
"hello3","byebye3"
"other","data"

cat nagios.cfg.txt

define host{
        use                          generic-host
        host_name                    hello
        alias                        other.hello2
        address                      127.0.0.1
        contact_groups               mymail
        parents                      hello3
}

cat test2.csv

"other","data"
"hello","byebye"
"hello2","byebye2"
"hello3","byebye3"
"other","data"

nawk -v sep='.' -f fran4.awk test2.csv nagios.cfg.txt

define host{
use generic-host
host_name byebye
alias data.byebye2
address 127.0.0.1
contact_groups mymail
parents byebye3
}

So now it changed. Hmm whats the case with your given test.csv
then?

diff test.csv test2.csv

1d0
< "hello","byebye"
2a2
> "hello","byebye"

I moved the 'hello' line DOWN 1 line in test.csv

It looks like there's something 'weird' [sorry for the 'technical' term] in the FIRST line of you test.csv file
Recreate it anew......

yep, seems to be that way.
seems to work fine now.

BIG, BIG thank you for helping me out.
I will get VIP account just to help this community my way also.

:b:

cheers and best regards,
Frankie