I want to search every line of search_file in keyword_file and print an output_file replacing the incorrect string of the line with the correct string extracted from keyword_file. Also, should warn the user if there are few entries with missing 3rd column, which do not exist in keyword_file and have in search_file (for example, "ggg coms" in the file)
Note, here keyword_file may contain an unequal number of line compared to search_file. For example: search_file
aaa coms 123
bbb coms 234
ccc
ddd coms 456
eez coms 789
fkk coms 987
ggg coms
hhh coms 989
....
keyword_file
aaa coms 789
bbb coms 234
ccc coms 878
ddd coms 456
ttt coms 654
eee coms 789
Output
aaa coms 789
bbb coms 234
ccc coms 878
ddd coms 456
eez coms 789
fkk coms 987
hhh coms 989
....
I tried the following awk command, but it was not able to retain column #1 entries of search_file in the Output.
awk 'FNR==NR{a[$1]=$0} FNR!=NR&&a[$1]{print $1,$2,$3}' search_file keyword_file
Thank you in advanced for your help :)