zsh-users
 help / color / mirror / code / Atom feed
* Upper case
@ 1999-10-25 19:54 Mircea Damian
  1999-10-25 21:50 ` Geoff Wing
  0 siblings, 1 reply; 8+ messages in thread
From: Mircea Damian @ 1999-10-25 19:54 UTC (permalink / raw)
  To: zsh-users


Hello,

I was wondering yesterday if there is a simple way to rename all my song
files(mp3) from


name with spaces.mp3   ->  Name With Spaces.mp3

with something like:
for i in *.mp3; do 
mv -v $i (UNKNOWN_PART_TO_ME)
done


I tried using sed there but with no luck. Can anyone give me a clue here?

-- 
Mircea Damian
E-mails: dmircea@kappa.ro, dmircea@roedu.net
WebPage: http://taz.mania.k.ro/~dmircea/


^ permalink raw reply	[flat|nested] 8+ messages in thread
* Re: Upper case
@ 1999-10-26 13:51 Sven Wischnowsky
  0 siblings, 0 replies; 8+ messages in thread
From: Sven Wischnowsky @ 1999-10-26 13:51 UTC (permalink / raw)
  To: zsh-users


Andrei Zmievski wrote:

> On Mon, 25 Oct 1999, Geoff Wing wrote:
> > One way:
> > 	mv $i ${${(C)i}:s/Mp3/mp3/}
> 
> Could someone explain this one to me, piece by piece? Obviously,
> s/Mp3/mp3 does a substitution but what is ${${(C)i}} all about?

It's quite simple, actually. In `${name}' substitutions, the `name'
may also be another substitution. The outer one will then work on the
result of the inner one (of course they can be nested as deeply as you 
want). So the `${(C)i}' is a parameter substitution with a flag, the
`(C)'. Such flags not supported by other shells, so I think this is
what really irritates you. Zsh has several such flags, some are
rather baroque, but many are quite useful, see the `Parameter
Expansion' section in the docs (in the `zshexpn.1' man page if you use 
the manual). Sorry, there are too many flags to explain all of them
here.
Anyway, the `${(C)i}' yields the contents of the parameter `i'
capitalized. This string is then used by the `${...:s/Mp3/mp3}' which
just replaces every `Mp3' with `mp3', of course.

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~1999-10-26 16:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-10-25 19:54 Upper case Mircea Damian
1999-10-25 21:50 ` Geoff Wing
1999-10-26  7:39   ` Mircea Damian
1999-10-26 13:19     ` Mohamed LRHAZI
1999-10-26 13:25     ` Upper case [correction] Mohamed LRHAZI
1999-10-26 14:47       ` Mohamed LRHAZI
1999-10-26 13:34   ` Upper case Andrei Zmievski
1999-10-26 13:51 Sven Wischnowsky

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).