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.

Michał Šrajer
  • 2,808
  • 17
  • 17
4
rename 's/20120117/20120113/' ORDER_EVENTS_*20120117.log

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

Nikhil Mulley
  • 8,145
  • 32
  • 49
0

Or use mmv:

  mmv "*17.log" "#1\13.log"
daniel kullmann
  • 9,427
  • 11
  • 38
  • 45