I have 2 files.
File 1
This is a string = mystringrocks
This is another string = mystringrocksmore
File 2
Trying to figure out: This is a string
Still trying to figure it out: This is another string
Desired output:
Trying to figure out: mystringrocks
Still trying to figure it out: mystringrocksmore
I'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 a
readarray a <filea.txt
echo $a
declare -a b
readarray b <fileb.txt
echo $b
for line in 'fileb.txt';
do sed -i -- 's/$line/$a/' file.txt
done
To no avail.