Skip to content

Instantly share code, notes, and snippets.

@cargowire
Created August 17, 2012 15:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cargowire/3380076 to your computer and use it in GitHub Desktop.
Save cargowire/3380076 to your computer and use it in GitHub Desktop.
Rename files by adding a suffix after a fixed number of characters from the original string (assumes no '.' in filenames)
for i in *.$1;
do
IFS="." read -ra parts <<< "$i"
mv $i ${parts[0]:0:$3}$2.${parts[1]};
unset IFS
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment