#!/bin/bash #Usage $ rename4esp ext "RegExp" "Replacement_String" #will rename the names of all files extension "ext" by #substituting "RegExp" by "ReplacementString". #Note that "RegExp" is actually a real regular expression #Of course it can accommodate a simple character sequence # Example # $ rename4esp dat " " "_" # will rename files with extension "dat" # by substituting ALL blanks with underscores ls -1 *."$1" | awk '{a=$0;gsub(/'"$2"/,\""$3"\"');print "mv","\""a"\"","\""$0"\""}'