Rename a group of files based on a regex

Posted on
Suppose you want to rename the name of a group of files that have the following template:
file1_tmp.sh
file2_tmp.sh
...
file99_tmp.sh
and suppose you want to remove the '_tmp' middle part in all the files. We can use the command "rename" or "prename":
 rename 's/_tmp//' *.sh