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

Re: Title Case a Textified String



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