Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Title Case a Textified String
- X-seq: zsh-users 14913
- From: Frank Terbeck <ft@xxxxxxxxxxxxxxxxxxx>
- To: zzapper <david@xxxxxxxxxx>
- Subject: Re: Title Case a Textified String
- Date: Thu, 11 Mar 2010 14:14:11 +0100
- Cc: zsh-users@xxxxxxx
- In-reply-to: <Xns9D38815866DD0zzappergmailcom@xxxxxxxxxxxx> (zzapper's message of "Thu, 11 Mar 2010 12:43:01 +0000 (UTC)")
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <Xns9D38815866DD0zzappergmailcom@xxxxxxxxxxxx>
zzapper wrote:
> I want to convert a textified string to a Title Case Phrase
>
> eg
> fred-goat-dog.jpg to Fred Goat Dog
>
> My first timid effort
>
> echo "fred-goat-dog.jpg" | sed 's/-/ /g' | sed 's/\.jpg//'
>
>
> Perl would do this with ease but is there a zsh solution (of course there
> is!)
Yeah, there is:
% foo='fred-goat-dog.jpg'
% print ${(C)${foo:r}//-/ }
Fred Goat Dog
Regards, Frank
--
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
-- RFC 1925
Messages sorted by:
Reverse Date,
Date,
Thread,
Author