renaming (lots of) files in bash

I found this method the other day. Unfortunately, I forget where.

$ for f in `ls -1 | grep string`; do mv $f ${f/string/replace};done

I’d like to find a method of using the bash command `find’, but this is pretty clean, and I don’t yet know how to manipulate the `{}’ in find -exec {} \;

great site for explaining bash variable manipulation.

  • Reddit
  • Technorati
  • Twitter
  • Facebook
  • Google Bookmarks
  • HackerNews
  • PDF
  • RSS
This entry was posted in programming and tagged . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.