zsh-users
 help / color / mirror / code / Atom feed
* tr alke expansion?
@ 2006-05-12 15:12 Marc Chantreux
  2006-05-12 15:20 ` Clint Adams
  0 siblings, 1 reply; 4+ messages in thread
From: Marc Chantreux @ 2006-05-12 15:12 UTC (permalink / raw)
  To: zsh-users

hi all,

is there a tr alike expansion in zsh ? something like :

% a=éèê
% echo ${a(t:éèê:eee:)}
eee

regards
mc


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

* Re: tr alke expansion?
  2006-05-12 15:12 tr alke expansion? Marc Chantreux
@ 2006-05-12 15:20 ` Clint Adams
  2006-05-12 15:37   ` Marc Chantreux
  0 siblings, 1 reply; 4+ messages in thread
From: Clint Adams @ 2006-05-12 15:20 UTC (permalink / raw)
  To: Marc Chantreux; +Cc: zsh-users

> is there a tr alike expansion in zsh ? something like :
> 
> % a=???
> % echo ${a(t:???:eee:)}
> eee

That doesn't look very tr-like.  Maybe you want

print ${a/\?\?\?/eee}

or

print ${a//\?/e}


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

* Re: tr alke expansion?
  2006-05-12 15:20 ` Clint Adams
@ 2006-05-12 15:37   ` Marc Chantreux
  2006-05-12 16:08     ` Clint Adams
  0 siblings, 1 reply; 4+ messages in thread
From: Marc Chantreux @ 2006-05-12 15:37 UTC (permalink / raw)
  To: zsh-users

Clint Adams wrote:
>> is there a tr alike expansion in zsh ? something like :
>>
>> % a=???
>> % echo ${a(t:???:eee:)}
>> eee

something wrong there : there are accents in my original post :)

i write it again but with a notation 'e = eacute, etc ...

% a="i want to erase accents 'e`e^e^o"
% echo ${a(t:'e`e^e^o:eeeo:)}
i want to erase accents eeeo

this is a better exemple ...


regards



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

* Re: tr alke expansion?
  2006-05-12 15:37   ` Marc Chantreux
@ 2006-05-12 16:08     ` Clint Adams
  0 siblings, 0 replies; 4+ messages in thread
From: Clint Adams @ 2006-05-12 16:08 UTC (permalink / raw)
  To: Marc Chantreux; +Cc: zsh-users

> something wrong there : there are accents in my original post :)

Sorry; embarrassing glitch on my side.  Lifted from
http://www.zsh.org/mla/users/2001/msg00221.html:

first=éèê
second=eee
a=bébèbê
print ${a//(#b)([$first])/${second[${first[(I)$match]}]}}

This does not work with multibyte character sets such
as UTF-8.


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

end of thread, other threads:[~2006-05-12 16:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-12 15:12 tr alke expansion? Marc Chantreux
2006-05-12 15:20 ` Clint Adams
2006-05-12 15:37   ` Marc Chantreux
2006-05-12 16:08     ` Clint Adams

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