All of lore.kernel.org
 help / color / mirror / Atom feed
From: Helge Pettersen <tubamann@gmail.com>
To: linux-admin@vger.kernel.org
Cc: zyserman@fcaglp.unlp.edu.ar
Subject: Re: renaming multiple files
Date: Mon, 22 Nov 2004 19:30:13 +0100	[thread overview]
Message-ID: <e29bf9c504112210306a7ef839@mail.gmail.com> (raw)
In-Reply-To: <2005107FDBE38F10D101E700@192.168.1.247>

This is also possible to do with the rename command.
As stated in the help file: rename <from> <to> <files>.
So in your case this would be: rename "prefix-" "" prefix*
In my opinion, a lot easier than using a for loop. :-)

On Mon, 22 Nov 2004 17:42:58 +0100, harry_b@mm.st <harry_b@mm.st> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hi Fabia,
> 
> try something like this:
> 
> for f in prefix-*; do n=`echo $f | sed -e 's/prefix-//'`; echo $f $n; done
> 
> Make sure you use backticks for the n= part of the line!
> 
> When you replace 'echo' with 'mv' the files get renamed. :-)
> 
> Have fun!
> 
> Harry
> 
> - --On Monday, November 22, 2004 12:57:40 -0300 Fabio Zyserman
> 
> 
> <zyserman@fcaglp.unlp.edu.ar> wrote:
> 
> > Hi all,
> >
> > I have some files in a directory, called
> > prefix-file1
> > prefix-file2
> > etc
> >
> > I want to rename them to
> > file1
> > file2
> > etc
> >
> > How can I do it with a bash command?
> 
> - --
> 
> 1024D/40F14012 18F3 736A 4080 303C E61E  2E72 7E05 1F6E 40F1 4012
> 
> - -----BEGIN GEEK CODE BLOCK-----
> Version: 3.12
> GIT/S dx s: a C++ ULS++++$ P+++ L+++$ !E W++ N+ o? K? !w !O !M
> V PS+ PE Y? PGP+++ t+ 5-- X+ R+ !tv b++ DI++ D+ G e* h r++ y++
> - ------END GEEK CODE BLOCK------
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.5 (GNU/Linux)
> 
> iD8DBQFBohcSfgUfbkDxQBIRAhFkAJ9+2zjDXYqe3jfiEihAcBBfabxrgACfT1Uc
> dLphj9Bv4wr3Md9+JhspsAI=
> =FWw3
> -----END PGP SIGNATURE-----
> 
> 
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-admin" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

  parent reply	other threads:[~2004-11-22 18:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-22 15:57 renaming multiple files Fabio Zyserman
2004-11-22 16:42 ` harry_b
2004-11-22 18:03 ` urgrue
     [not found] ` <2005107FDBE38F10D101E700@192.168.1.247>
2004-11-22 18:30   ` Helge Pettersen [this message]
2004-11-23  1:30 ` Glynn Clements
2004-12-08  1:05   ` Jeff Woods
2004-12-09 19:09     ` Glynn Clements
2004-12-09 21:02       ` Jeff Woods
2004-12-10 15:17         ` Glynn Clements

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e29bf9c504112210306a7ef839@mail.gmail.com \
    --to=tubamann@gmail.com \
    --cc=linux-admin@vger.kernel.org \
    --cc=zyserman@fcaglp.unlp.edu.ar \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.