Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

There are files with


and so on..

I need to rename them to


and so on..

How can I do that?

share|improve this question

marked as duplicate by Kevin, Gilles, Michael Mrozek Jan 22 '12 at 19:48

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 3 down vote accepted
rename 's/20120117/20120113/' ORDER_EVENTS_*20120117.log

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

share|improve this answer


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

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

share|improve this answer
Nikhil did easier regexp (+1). Anyhow I will leave this for the reference. – Michał Šrajer Jan 17 '12 at 15:55
+1 for hint on -n switch – feeela Sep 18 '12 at 21:22

Or use mmv:

  mmv "*17.log" "#1\13.log"
share|improve this answer