Rename file 

The aim for above is to batch rename files. Should do like this, according to the faq:

You can also convert file names into "mv" commands with 'sed', and hand the commands off to "sh" for execution. Try

ls -d *.foo | sed -e 's/.*/mv & &/' -e 's/foo$/bar/' | sh
[Note]

This is only work for changing the extensions! and a better way to do is just:

for i in *.txt; do mv $i `basename $i .txt`.c; done

Renaming parts other than extension 

ls -1 *.htm | xargs -i echo " mv" {} > fr
ls -1 *.htm |sed "s/xxx/yyy/" | paste fr - | sh

documented on: 08-07-99