In a directory there are these files and more:file1.txtfile1.html file1.pdf...Every file1 should be replaced with newfile:newfile.txtnewfile.htmlnewfile.pdf...I've tried:for f in $(ls file1*); do mv $f newfile*; donethis does replace all files with file1 to one file newfile*. for f in $(ls file1*); do mv $f ${f/$f/newfile}; donethis also replaces all files with file1 to one file newfile.Orfind . -name file1.* -exec sh -c 'mv I DONT KNOW' _ {} \;I don't understand how to set a part of the file name as a variable and replace this.What is the simplest way to do this with mv?
Rename first part of multiple files with mv
bash;mv