Avoid overwriting backup file when multiple entries need to replace in one file input from another

Hello,
I have been working on script in which search and replace the multiple pattern.

  1.   update_params.sh read the multiple pattern from input file ParamMapping.txt\(old\_entry|New_entry\) and passing this values one by one to  change_text.sh
    
  2.   change_text.sh read input from update_params.sh 
    

search files and based upon parameter(search and replace) from update_params.sh generates FileList.lst
for each files in FileList.lst it takes backup(.bkp) and replace the string and update in to new file.

Issue when a same file contain multiple string defined in ParamMapping.txt which is going to be replace, it also replaces the entry in .bkp files which I have to avoid.
I am not able to figure out how to avoid overwriting .bkp file when multiple entries need to replace in one file.

PFA files.

file execution :

./update_params.sh ParamMapping.txt 

Any suggestions will be helpful.....:slight_smile:

Thanks,
Ketan R