I'd like to replace some file extension in an SQL file when I match strings from an input file using terminal.
I have an input.txt containing a list of file paths.
/2014/02/haru-sushi_copertina_apdesign-300x300.png
/2014/02/haru-sushi_copertina_apdesign.png
/2014/02/harusushi_01_apdesign-300x208.png
ect ect
Then I have a WordPress.sql file
What I'd like to do, whenever I find a match between the 2 files, is to replace the extension from .png to .jpg in the database file of that matching. I hope I've made myself clear.
Should I use sed with regular expressions? Something like
cat input.txt | while read -r a; do sed -i 's/$a/.jpg/g' wordpress.sql; done
Any suggestions? Even for the RegEx.