find . -name '*.txt' -exec sh -c 'x="{}"; mv "$x" "${x//2010/2022}"' \;Whats under the hood?
- find command finds the files that ending with *.txt using -name parameter
- -exec parameter executes move (
mv) command for each found file - second move argument
${x//2010/2022}replaces string2010with2022in file names using shell parameter expansion