Re: renaming multiple files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----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@xxxxxxxxxxxxxxxxxx> 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-----

-
: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Newbie]     [Audio]     [Hams]     [Kernel Newbies]     [Util Linux NG]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Device Drivers]     [Samba]     [Video 4 Linux]     [Git]     [Fedora Users]

  Powered by Linux