[PLUG] substitution question...
Eitan Tsur
eitan.tsur at gmail.com
Tue Dec 9 02:19:25 UTC 2008
Nope. You have it down exactly right. In truth what I was doing was a
kludge, as I'm running a script to organize my music collection. Here's the
line:
newName="`echo "$i" | sed 's/_/\ /g' | sed 's/ /\ /g' | perl -p -e
's/(\\w+)/\\u\\L$1/g;' | sed 's/[mM]4[aA]/m4a/g' | sed
's/[mM][pP]3/mp3/g'`";
Basically the first sed replaces underscores with spaces, the second I
think(?) escapes space characters, the perl bit looks confusing to me and
I'm really too lazy to figure out exactly what it does. What I _think_ it
does is capitalize the first letter of every word, which is why I get stuff
like "Fred'S " when I want "Fred's ". (I'm assuming an apostrophe acts like
a word break or something). The last two sed parts lowercase stuff in a way
which I am sure could be made more pretty.
On Mon, Dec 8, 2008 at 2:54 PM, Fred James <fredjame at fredjame.cnc.net>wrote:
> Eitan Tsur wrote:
> > Anyone know how to convert the capitalized character after apostrophe(s)
> in
> > a string to lowercase? (using s/// in sed, perl, etc...)
> >
> Eitan Tsur
> Let me see if I understand what you are asking ... the pattern will be ...
> some string of characters followed by
> an apostrophe followed by
> a character followed by
> at least one space character
> ... such that if this might be an example ...
> Albert'S house isn'T very new and his last name is O'Malley.
> ... you would want to convert the S and T to s and t, but the M should
> stay M ... like this ...
> Albert's house isn't very new and his last name is O'Malley.
>
> Is that is correct then? Any other details to consider?
> Regards
> Fred James
>
> _______________________________________________
> PLUG mailing list
> PLUG at lists.pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug
>
More information about the PLUG
mailing list