[expert] renaming large number of files.

2002-01-26 Thread Ricardo Castanho de O. Freitas

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

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.

TIA

[]s Ricardo Castanho


- -- 
delivery NOT reliable  => [EMAIL PROTECTED]
==
Linux user # 102240 => Machine # 96125 => Seti@home user
==
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Para mais informações veja http://www.gnupg.org

iEYEARECAAYFAjxSxz0ACgkQqJymTCNNyXFdEwCgypdsMsGiCuXdptff75n6nzo2
SHoAoLhwVg7VsPzwAdMjafcqWId1h18G
=bBiP
-END PGP SIGNATURE-





Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com



Re: [expert] renaming large number of files.

2002-01-26 Thread Alexander Skwar

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



RE: [expert] renaming large number of files.

2002-01-26 Thread Jose M. Sanchez

Wow!

So complex!

How about

"rename a a_ *"


-JMS
[EMAIL PROTECTED]


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]] On Behalf Of Alexander Skwar
Sent: Saturday, January 26, 2002 2:06 PM
To: [EMAIL PROTECTED]
Subject: Re: [expert] renaming large number of files.


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 ;)




Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com



RE: [expert] renaming large number of files.

2002-01-26 Thread J. Craig Woods

At 03:15 PM 1/26/2002 -0500, Jose M. Sanchez wrote:
>Wow!
>
>So complex!
>
>How about
>
>"rename a a_ *"

Jose, such parsimony, I love it.


J. Craig Woods
UNIX/NT System Administrator
-Art is the illusion of spontaneity-




Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com



Re: [expert] renaming large number of files.

2002-01-26 Thread Alexander Skwar

So sprach »Jose M. Sanchez« am 2002-01-26 um 15:15:01 -0500 :
> Wow!
> 
> So complex!
> 
> How about
> 
> "rename a a_ *"

Yep, it was an easy example which rename can handle rather well.  But
more complex examples will very fast turn down rename.  And further, in
my example you can do all sorts of stuff with the $new_name besides
renaming the files.  Granted, Ricardo only asked for renaming the files,
but still... ;)

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: 12 days 1 hour 23 minutes



Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com



Re: [expert] renaming large number of files.

2002-01-26 Thread Ricardo Castanho de O. Freitas

On Sat, 26 Jan 2002, Alexander Skwar wrote:

Wow! Nothing like a question to the experts!!

With such volume of **good* commands ( and simple!) sometimes... it's hard
to get the *best* one!

task done!

Thank you all!

Gotta find my book on bash scripting, perl, sed and 'et cetera'! (mainly)

Ricardo Castanho



>So sprach »Jose M. Sanchez« am 2002-01-26 um 15:15:01 -0500 :
>> Wow!
>>
>> So complex!
>>
>> How about
>>
>> "rename a a_ *"
>
>Yep, it was an easy example which rename can handle rather well.  But
>more complex examples will very fast turn down rename.  And further, in
>my example you can do all sorts of stuff with the $new_name besides
>renaming the files.  Granted, Ricardo only asked for renaming the files,
>but still... ;)
>
>Alexander Skwar
>

-- 
delivery NOT reliable  => [EMAIL PROTECTED]
==
Linux user # 102240 => Machine # 96125 => Seti@home user
==




Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com



Re: [expert] renaming large number of files.

2002-01-27 Thread J. Grant

Hello Ricardo,

I was actually considering writing a bash script of this very feature today!

the problem is that you cant do "mv dcp_0*.jpg pics-*.jpg" or the like 
in linux. DOS allows for "ren dcp_0*.jpg pics-*.jpg" but they have to be 
the same number or characters...

I will check this out now. It should not be too hard to do... MY LAST 
WORDS...

JG

Ricardo Castanho de O. Freitas wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> 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.
> 
> TIA
> 
> []s Ricardo Castanho





Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com



Re: [expert] renaming large number of files.

2002-01-27 Thread Ricardo Castanho de O. Freitas

On Mon, 28 Jan 2002, J. Grant wrote:

Hi, JG,

Thanks for the attention!

I've 'managed' it, for the time being with 'rename' but, it does not
covers all the details, i.e., on my case after long, long hours of
recording audio cassettes, mastering, signal processing and etc...
I've been using gramofile for this work and it does have 'default' name
for the recording and the final audio sample. At the beginning, it was not
a big deal but, after reaching +15Gb of *.wav samples to manage and burn
CD'swow then it was a BIG trouble!

Thankfully, the guys from the list gave the 'rename' hint and it's working
for now.
But please let me know of any other solution.

The only question is how to find out so many 'commands' on Linux!
After the suggestion and seeing the results I went for some
explanation and find none, except for the man pages!

Does any body know how to find a ' list '  of resources from Linux?

Tks,

Ricardo Castanho


>Hello Ricardo,
>I was actually considering writing a bash script of this very feature today!
>the problem is that you cant do "mv dcp_0*.jpg pics-*.jpg" or the like
>in linux. DOS allows for "ren dcp_0*.jpg pics-*.jpg" but they have to be
>the same number or characters...
>I will check this out now. It should not be too hard to do... MY LAST
>WORDS...
>JG
>Ricardo Castanho de O. Freitas wrote:
>> -BEGIN PGP SIGNED MESSAGE-
>> Hash: SHA1
>> 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.
>> TIA

-- 
delivery NOT reliable  => [EMAIL PROTECTED]
==
Linux user # 102240 => Machine # 96125 => Seti@home user
==





Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com



Re: [expert] renaming large number of files.

2002-01-27 Thread J. Grant

I just checked, and rename does not seem to support renaming files such 
as pic1, pic2 -> pic1.jpg pic2.jpg etc? or does it?

it seems to require something to swap, the from option but if I want to 
add at the end I can not.

I think there are better ways to do this using a bash script and mv, i 
am sure others have done this already.

JG

Ricardo Castanho de O. Freitas wrote:

> On Mon, 28 Jan 2002, J. Grant wrote:
> 
> Hi, JG,
> 
> Thanks for the attention!
> 
> I've 'managed' it, for the time being with 'rename' but, it does not
> covers all the details, i.e., on my case after long, long hours of
> recording audio cassettes, mastering, signal processing and etc...
> I've been using gramofile for this work and it does have 'default' name
> for the recording and the final audio sample. At the beginning, it was not
> a big deal but, after reaching +15Gb of *.wav samples to manage and burn
> CD'swow then it was a BIG trouble!
>





Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com



Re: [expert] renaming large number of files.

2002-01-27 Thread Ricardo Castanho de O. Freitas

On Mon, 28 Jan 2002, J. Grant wrote:

Hi,

You want to add the extension right?
I can't give it a try now but I renamed 'processed0001.wav' to
'nice-name0001.wav' with no problem!

the first example sent to me was:
rename a a_ *

And it worked all right, then I thought why the '_' and worked again!
So you got to have something to trade for ;-)

On your case you have only pic but no extension to exchange for .jpg!

If you find a solution, please tell us!

Ricardo Castanho

>I just checked, and rename does not seem to support renaming files such
>as pic1, pic2 -> pic1.jpg pic2.jpg etc? or does it?
>
>it seems to require something to swap, the from option but if I want to
>add at the end I can not.
>
>I think there are better ways to do this using a bash script and mv, i
>am sure others have done this already.
>
>JG
>
>Ricardo Castanho de O. Freitas wrote:
>
>> On Mon, 28 Jan 2002, J. Grant wrote:
>>
>> Hi, JG,
>>
>> Thanks for the attention!
>>
>> I've 'managed' it, for the time being with 'rename' but, it does not
>> covers all the details, i.e., on my case after long, long hours of
>> recording audio cassettes, mastering, signal processing and etc...
>> I've been using gramofile for this work and it does have 'default' name
>> for the recording and the final audio sample. At the beginning, it was not
>> a big deal but, after reaching +15Gb of *.wav samples to manage and burn
>> CD'swow then it was a BIG trouble!
>>
>
>
>
>

-- 
delivery NOT reliable  => [EMAIL PROTECTED]
==
Linux user # 102240 => Machine # 96125 => Seti@home user
==




Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com



Re: [expert] renaming large number of files.

2002-01-28 Thread Pierre Fortin

On Mon, 28 Jan 2002 04:35:52 -0200 (BRST)
"Ricardo Castanho de O. Freitas" <[EMAIL PROTECTED]> wrote:

> Does any body know how to find a ' list '  of resources from Linux?

Press the TAB key at a prompt, then answer "y"...  :^)

Pierre



Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com



Re: [expert] renaming large number of files.

2002-01-28 Thread Alexander Skwar

So sprach »J. Grant« am 2002-01-28 um 15:44:32 +0900 :
> I just checked, and rename does not seem to support renaming files such 
> as pic1, pic2 -> pic1.jpg pic2.jpg etc? or does it?
> 
> it seems to require something to swap, the from option but if I want to 
> add at the end I can not.
> 
> I think there are better ways to do this using a bash script and mv, i 
> am sure others have done this already.

Well, I don't use rename, so I'd suggest to have a look at my example
with the regexp again.  But in the case of pic1, pic2 -> pic1.jpg,
pic2.jpg it's even simpler:

for f in *; do
mv $f $f.jpg
done

You can type this exactly like above on the shell prompt.

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: 14 days 9 hours 34 minutes



Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com



Re: [expert] renaming large number of files.

2002-01-29 Thread Alan Wilter Sousa da Silva

Read at

http://www.linuxdoc.org/LDP/abs/html/index.html

and find all about linux resources included in bash.

> On Mon, 28 Jan 2002 04:35:52 -0200 (BRST)
> "Ricardo Castanho de O. Freitas" <[EMAIL PROTECTED]> wrote:
>
> > Does any body know how to find a ' list '  of resources from Linux?


-- 
---
Alan Wilter S. da Silva
---
 Laboratório de Física Biológica
  Instituto de Biofísica Carlos Chagas Filho
   Universidade do Brasil/UFRJ
Rio de Janeiro, Brasil




Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com



Re: [expert] renaming large number of files.

2002-01-29 Thread Ricardo Castanho de O. Freitas

On Tue, 29 Jan 2002, Alan Wilter Sousa da Silva wrote:


That was not what I meant but, I guess it will do it! ;-)
[I used to love DOS batch files!]

As I have heard and felt Linux contains a "miriade"/"pletora" of commands
and I would like to find sources/resources for a better understanding of
this system... and what is quite bad... not all of them have a man page
(or info page) to help us! (as a volunteer translator/reviewer at ldp-br
[man pages] I could feel that!).

But then again...it's hard to find a 'command' you've never heard of!

But I'd better take your suggestion as a smooth (?) start!

tks

[]s Ricardo Castanho

>Read at
>
>http://www.linuxdoc.org/LDP/abs/html/index.html
>
>and find all about linux resources included in bash.
>
>> On Mon, 28 Jan 2002 04:35:52 -0200 (BRST)
>> "Ricardo Castanho de O. Freitas" <[EMAIL PROTECTED]> wrote:
>>
>> > Does any body know how to find a ' list '  of resources from Linux?
>
>
>

-- 
delivery NOT reliable  => [EMAIL PROTECTED]
==
Linux user # 102240 => Machine # 96125 => Seti@home user
==




Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com



Re: [expert] renaming large number of files.

2002-01-29 Thread Larry Sword

"Ricardo Castanho de O. Freitas" wrote:
> 
> On Tue, 29 Jan 2002, Alan Wilter Sousa da Silva wrote:
> 
> That was not what I meant but, I guess it will do it! ;-)
> [I used to love DOS batch files!]
> 
> As I have heard and felt Linux contains a "miriade"/"pletora" of commands
> and I would like to find sources/resources for a better understanding of
> this system... and what is quite bad... not all of them have a man page
> (or info page) to help us! (as a volunteer translator/reviewer at ldp-br
> [man pages] I could feel that!).
> 
> But then again...it's hard to find a 'command' you've never heard of!
> 
> But I'd better take your suggestion as a smooth (?) start!
> 
> tks
> 
> []s Ricardo Castanho

You may have read this, and since you are coming from from the DOS
world, the DOS-Win-to-Linux-HOWTO may prove helpful.
  
Larry


> >Read at
> >http://www.linuxdoc.org/LDP/abs/html/index.html
> >
> >and find all about linux resources included in bash.
> >
> >> On Mon, 28 Jan 2002 04:35:52 -0200 (BRST)
> >> "Ricardo Castanho de O. Freitas" <[EMAIL PROTECTED]> wrote:



Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com



Re: [expert] renaming large number of files.

2002-01-29 Thread Pen Gwynne

This is a resend from a reply to a thread titled "sed or awk or ?"

There are few ways to do this, but here is one.  It is not particularly  
elegant; just a brute force way of doing it.  

But it does have the advantage of letting you test whether and how it will 
work by uncommenting the "print" statement and commenting out the "system".  
You can see if running the program does what you really want it to do and 
make changes before you go mucking about with the real mv command.

In this case person asking for help wanted to rename files named 
"process." to "adi.".  

Trying this out will introduce you to gawk and regular expressions.  Really 
cool stuff.

I'm pretty sure you could do this directly in bash, but I'm not particularly 
strong there.

/Pen

--
Create the following awk file named, say, "doit.awk" using your favorite 
editor.   Do this in, say, your home directory.

{
  if (/^processed/)
{
new = $1
gsub(/^processed/, "adi", new)
syscmd = "mv " $1 " " $new
   # print syscmd
system(syscmd)
}
}

In the directory that you want to change the filenames, execute the command

ls -1 > myfiles

Now do the following command

gawk -f ~/doit.awk myfiles




Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com



Re: [expert] renaming large number of files.

2002-01-30 Thread Simon Naish

OK Try th comman apropos  at the prompt, it gives you a list of man pages to look 
through that contain reference to parameters that you give the command

ie

> apropos bash

Gives a huge list!!

Hope this helps

si
-Original Message-
From: Larry Sword <[EMAIL PROTECTED]>
Date: Tue, 29 Jan 2002 08:48:08 -0800
To: [EMAIL PROTECTED]
Subject: Re: [expert] renaming large number of files.


> "Ricardo Castanho de O. Freitas" wrote:
> > 
> > On Tue, 29 Jan 2002, Alan Wilter Sousa da Silva wrote:
> > 
> > That was not what I meant but, I guess it will do it! ;-)
> > [I used to love DOS batch files!]
> > 
> > As I have heard and felt Linux contains a "miriade"/"pletora" of commands
> > and I would like to find sources/resources for a better understanding of
> > this system... and what is quite bad... not all of them have a man page
> > (or info page) to help us! (as a volunteer translator/reviewer at ldp-br
> > [man pages] I could feel that!).
> > 
> > But then again...it's hard to find a 'command' you've never heard of!
> > 
> > But I'd better take your suggestion as a smooth (?) start!
> > 
> > tks
> > 
> > []s Ricardo Castanho
> 
> You may have read this, and since you are coming from from the DOS
> world, the DOS-Win-to-Linux-HOWTO may prove helpful.
>   
> Larry
> 
> 
> > >Read at
> > >http://www.linuxdoc.org/LDP/abs/html/index.html
> > >
> > >and find all about linux resources included in bash.
> > >
> > >> On Mon, 28 Jan 2002 04:35:52 -0200 (BRST)
> > >> "Ricardo Castanho de O. Freitas" <[EMAIL PROTECTED]> wrote:
> 
> 

-- 

___
Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup

Win a ski trip!
http://www.nowcode.com/register.asp?affiliate=1net2phone3a





Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com