From mboxrd@z Thu Jan 1 00:00:00 1970 From: Helge Pettersen Subject: Re: renaming multiple files Date: Mon, 22 Nov 2004 19:30:13 +0100 Message-ID: References: <41A20C74.4050709@fcaglp.unlp.edu.ar> <2005107FDBE38F10D101E700@192.168.1.247> Reply-To: Helge Pettersen Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <2005107FDBE38F10D101E700@192.168.1.247> Sender: linux-admin-owner@vger.kernel.org List-Id: Content-Type: text/plain; charset="us-ascii" To: linux-admin@vger.kernel.org Cc: zyserman@fcaglp.unlp.edu.ar This is also possible to do with the rename command. As stated in the help file: rename . 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 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 > > > 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 >