> #!/bin/bash
> # <tr><td class="col1"><a href="111_12.html">Agrawal, B.M. 
> and Kumar, Virendra</a></td> # <tr><td class="col1"><a 
> href="111_12.html#Agrawal">Agrawal, B.M. and Kumar, 
> Virendra</a></td> cat titles.html | sed 's/"col1"><a 
> href="\(.*\)\.html">\([A-Z][a-z]*\),/"col1"><a 
> href="\1.html#\2">\2,/' > test.html
> 
> How can I lower case the anchors i.e. #Agrawal to #agrawal? 
> I know that tr can do that but the above is in a sed script 
> adn I can't use tr there.
> sed does not have a lower function.
> Maybe I have to do in two passes somehow?

Can you not simplay add \l (force next element to lowercase) in your 
replacement?

Eg (untested) ...

cat titles.html | sed 's/"col1"><a 
href="\(.*\)\.html">\([A-Z][a-z]*\),/"col1"><a href="\1.html#\l\2">\2,/' > 
test.html

- Rog
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to