0

Possible Duplicate:
How can I rename a lot of files using a regex?
Rename All Files with a Certain Name

There are files with

ORDER_EVENTS_SOMETHING_20120117.log
ORDER_EVENTS_SOME2_20120117.log
ORDER_EVENTS_CHARS_20120117.log

and so on..

I need to rename them to

ORDER_EVENTS_SOMETHING_20120113.log
ORDER_EVENTS_SOME2_20120113.log

and so on..

How can I do that?

3 Answers3

6

do:

rename -n 's/(.*)_20120117/$1_20120113/' ORDER_EVENTS*

once you sure this is it, remove the -n option.

4
rename 's/20120117/20120113/' ORDER_EVENTS_*20120117.log

This assumes that all the files to be renamed are in the same directory.

0

Or use mmv:

  mmv "*17.log" "#1\13.log"
daniel kullmann
  • 9,527
  • 11
  • 39
  • 46