LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] How do I mv a bunch of files w/ a RE?

[ILUG] How do I mv a bunch of files w/ a RE?

John P. Looney john at antefacto.com
Tue Jul 3 12:47:23 IST 2001


On Sun, Jul 01, 2001 at 12:41:49AM +0200, Braun Brelin mentioned:
> 
> a001.html
> a002.html
> a003.html
> 
> I'd like to find a single 'mv' command to change these files from axxx.html 
> to bxxx.html.
> 
> Obviously, commands like 'mv a???.html b???.html' don't work.
> I'd prefer a single line shell command rather than some sort of foreach if 
> possible.

 The command you need is "rename".


NAME
       rename - Rename files

SYNOPSIS
       rename from to file...

DESCRIPTION
       rename  will  rename  the specified files by replacing the
       first occurrence of from in their name by to.

       For example, given the files foo1, ..., foo9, foo10,  ...,
       foo278, the commands

              rename foo foo0 foo?
              rename foo foo0 foo??

       will  turn  them  into  foo001,  ..., foo009, foo010, ...,
       foo278.

       And
              rename .htm .html *.htm

       will fix the extension of your html files.

Kate

-- 
 When I say 'free', I mean 'free': free from bond, of chain or command: 
to go where you will, even to Mordor, Saruman, if you desire. " 
    -- Gandalf, paraphrasing the choice between Free and Non-free software




More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell