/ Published in: Bash

URL: http://www.macosxhints.com/article.php?story=20010509130450691
Leave off the final pipe to /bin/sh to do a 'dry run'
Expand |
Embed | Plain Text
ls foo*.jpg | awk '{print("mv "$1" "$1)}' | sed 's/foo/bar/2' | /bin/sh
Comments

You need to login to post a comment.
You can also do other commands to select files to rename. Like
find . -name "foo*.jpg" | awk '{print("mv "$1" "$1)}' | sed 's/foo/bar/2' | /bin/sh