Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Title Case a Textified String



On 11 March 2010 13:43, zzapper <david@xxxxxxxxxx> wrote:
> Hi
> 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!)

foo=fred-goat-dog.jpg
echo ${(C)foo:gs/-/ /:r}

-- 
Mikael Magnusson



Messages sorted by: Reverse Date, Date, Thread, Author