Please Help to Check script Search and Replace
Ex. Search 0001 and Replete un_0001
---script
Code:
nawk -F\" 'NR==FNR{a[$0];next}$2 in a{sub($2,"un_"$2)}1' input.txt file*.txt > resoult.txt
script is work to one result but
if i have file1.txt, file2.txt, file3.txt i want to Replace Result in old file
please help again
thank you
---file1.txt
Event: "0001","0002","0001","0003"
Event: "0002","0002","0001","0003"
Event: "0003","0002","0001","0003"
Event: "0003","0002","0001","0003"
---file2.txt
Event: "0003","0002","0001","0003"
Event: "0002","0002","0001","0003"
Event: "0001","0002","0001","0003"
Event: "0001","0002","0001","0003"
--- input.txt
0001
0003
---Result
---file1.txt
Event: "un_0001","0002","0001","0003"
Event: "0002","0002","0001","0003"
Event: "un_0003","0002","0001","0003"
Event: "un_0003","0002","0001","0003"
---file2.txt
Event: "un_0003","0002","0001","0003"
Event: "0002","0002","0001","0003"
Event: "un_0001","0002","0001","0003"
Event: "un_0001","0002","0001","0003"