Skip to content

Instantly share code, notes, and snippets.

@afrendeiro
Created February 4, 2016 09:43
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save afrendeiro/d4d536f1e014d369f365 to your computer and use it in GitHub Desktop.
Mass rename files cheatsheet
# I just need to have these somewhere to remember them later
for F in `find . | grep -e 'CM[0-9]\{2,\}s'`
do
echo $F $(echo $F | sed 's/CM\([0-9]\{2,\}\)s/CM\1-/g')
mv $F $(echo $F | sed 's/CM\([0-9]\{2,\}\)s/CM\1-/g')
done
for F in `find . | grep -e '_[1-2]_' | grep -v PBMC`
do
echo $F $(echo $F | sed 's/_[1-2]_/_/g')
mv $F $(echo $F | sed 's/_[1-2]_/_/g')
done
for F in `find . | grep -e '1-5-60426'`
do
echo $F $(echo $F | sed 's/1-5-60426/1-5-60462/g')
mv $F $(echo $F | sed 's/1-5-60426/1-5-60462/g')
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment