Hi all

I have a titles.html file from someone that has several hundred authors listed in a table. e.g. <tr><td class="col1"><a href="111_12.html">Agrawal, B.M. and Kumar, Virendra</a></td>

At present the above link goes to the top of that file (the contents of that journal issue) but I want the link to directly go to the authors article in that directory. There are already name anchors in the file but they are lower case such as: <a name="agrawal"></a>

The script below will take extract the authors name from after the link so that <a href="111_12.html">Agrawal, B.M becomes....
<a href="111_12.html"#Agrawal>Agrawal, B.M


but the name anchors in the many journal files are all lower case like this:
<a name="agrawal"></a>

thus my links don't work.

#!/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?


--
Mike Lake
Caver, Linux enthusiast and interested in anything technical.

--
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