I have 2 files. File 1This is a string = mystringrocksThis is another string = mystringrocksmoreFile 2Trying to figure out: This is a stringStill trying to figure it out: This is another stringDesired output:Trying to figure out: mystringrocksStill trying to figure it out: mystringrocksmoreI've tried a number of things, the most recent of which is to load the two files into an array and looping with sed.#!/bin/bash    declare -a areadarray a <filea.txtecho $adeclare -a breadarray b <fileb.txtecho $bfor line in 'fileb.txt'; do sed -i -- 's/$line/$a/' file.txt  doneTo no avail.
Replacing substring in file a with string in file b when a match is found
shell script;text processing