Submitted by MohammedSameer on Fri, 17/06/2005 - 22:17.
In the old days, I was using a for loop to rename multiple files.
Today I've discovered a new command: rename(1)
rename is not a traditional UNIX command but it comes with perl, And I guess you'll find a system without perl these days ;)
rename-
Imaginr that you have some files with underscores in their names and you want to change the underscores to spaces.
In the old days I used to do:
for i in *; do echo mv $i "`echo $i | tr _ \ `"; done | bash
Now I can do:
rename 's/_/ /g' *
Note that s/_/ /g is a perl regular expression "perl regex"
for more information:
perldoc perlre

Get GNU / Linux
News Feed
Popular Content
Event Photos
Members
Polls
Blogs
Screen Shots
Search
Wall Papers