I'm trying to write a bash script that converts html file into latex file by processing each line with sed. I'm stuck with following issue:
I need to replace <a name="[I]something[/I]">
with \index{[I]something_else[/I]}
. I have an associative array with key-value pairs like this: "[I]something[/I]" => "[I]something_else[/I]"
. However, there are 2 catches:
- Not all strings from
<a>
tags are present. If I don't find an array element with"[I]something[/I]"
key I need to skip creation of\index{}
. - Some lines contain more than one occurrence of
'<a name="...">'
.
Any suggestions?