Let’s assume I have a directory full of files that have names containing index.php@ which I want to replace with index.html. .
Adding one more issue: all those files are actually HTML that contains links to each other.
I’d like to rename them and keep all the links working. Bash to the rescue:
for old in ./index.php*; do new=$(echo $old | sed -e 's/.php@/.html./'); mv -v "$old" "$new"; done find . -type f -exec sed -i 's/php@/html./g' {} ';'
Did it work? It looks so: