So sprach �Ricardo Castanho de O. Freitas� am 2002-01-26 um 13:11:50 -0200 :
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
That's not needed, IMO.
>
> How can I rename large number of files?
>
> They follow a standard and and numbered sequencially.
>
> The idea is to give a meaningful name to them.
mmv can do that. However, I more often end up hacking together a small
regexp, which I then use kinda like this:
files:
a001.png
a231.png
ija231.bmp
Now I'd want to put a _ between the letters and the numbers and also
want to rename them all to .gif
for f in * ; do
new_name=$(echo $f | perl -p -e 's|(\w+?)(\d+)\..*|$1_$2.gif|')
# Or maybe:
# new_name=$(echo $f | perl -p -e 's|([:alpha:]+)(\d+)\..*|$1_$2.gif|')
echo $new_name
done
regexp's are cool ;)
Alexander Skwar
--
How to quote: http://learn.to/quote (german) http://quote.6x.to (english)
Homepage: http://www.iso-top.de | Jabber: [EMAIL PROTECTED]
iso-top.de - Die g�nstige Art an Linux Distributionen zu kommen
Uptime: 11 days 21 hours 24 minutes
Want to buy your Pack or Services from MandrakeSoft?
Go to http://www.mandrakestore.com