Hello, i am bit stuck with making script for automatic procedure.
Case:
Two files. One is flat file, other is csv file.
csv file has two column/fields with comma delimited data.
Here is what i need (explained way)
CSV file:
field1 | field2
"hello","byebye"
"hello2","byebye2"
"hello3","byebye3"
Flat file has matching data:
"hello"
"hello2"
"hello3"
If found:
"hello"
"hello2"
"hello3"
..in flat file, then it must be replaced from csv file with FIELD2 according
to search match.
But i have to search "hello" from csv file field1 data with flat file together and if found match in
flat file, it must be replaced from csv file with field2 data.
I know i could split csv file to two files, one containing field1 data and
second file field2 data but that would be not so dynamic way.
Though then i could easily use loop with cat + sed
Idea is to make nagios mass updating hosts naming changes in config.
So im wondering could i do it with awk or sed more universal way?
Any examples would be great help.
Thanks in advance..
Frankie