As you can see in the script example down there, I'm trying to find and replace (inplace replace) a string which is part of an URL with another string (url part) within ALL files found with that pattern of URL.
In other words, all *.txt files which contain 'https://hostname/' must be found and then the string 'https://hostname/' must be replaced within the whole file with 'https://hostname.fq.dn/'
so far I put together this:
grep -L -R -e 'https://hostname/' /srv/www/htdocs/intranet/data/pages/ | grep '.txt$' | xargs -n1 sed -i.bak 's|https://hostname/|https://hostname.fq.dn/|'
I guess there must be an error within the sed regex somewhere. I searched and read for hours and still not found the problem. Backup files are created by sed, but nothing seems to be replaced within the files.
Any tip for me? Like how I can debug the regex I'm using in sed? I'm pretty lost and even didn't found anything like that here on stackexchange/serverfault yet.