Hi gang,

I am trying to create some batch commands for many html pages I need to re-format.

I am trying the number 2b in this example to wrap anchor tags around the number that will be referenced in the footnotes.

I am trying to use the h/H hold command, but I have never tried using it before and it is not yet working.

From the sed help file example it uses the 'g/G' to extract whatever is in the hold buffer.

So basically, each of my html pages have pages numbers of text referring to the original text book numbers and used to reference each pages footnotes. So I want sed, each time it finds a page number to hold that page number in 'h/H' and then check each line after for '2b' or any number in which the line does not begin with '<' (already formatted with HTML tags) and wrap the number in anchor tags according to the last page number held in HOLD.

Most pages have multiple page references, so every time sed encounters a new page number, it should re-write the HOLD space with new page number and begin applying that to each anchor, until of course another new page number is encountered.

I thought I had that with:
Code:
sed -i -e '/[0-9]\{1,3\}$/{h;};/^</!s/\([0-9]\{1,3\}[b]\{,1\}\)/\<a href="g\1End" name="g\1Txt"><font size=-1">[g:\1]<\/font><\/a>/g' 1.html
but for this line of text:
Code:
From old IkshvŠku's  2b line he came,
I get:
Code:
From old IkshvŠku's  <a href="g2bEnd" name="g2bTxt"><font size=-1">[g:2b]</font></a> line he came,
It looks like 'g/G' is not what I need to extract whatever is (hopefully) in the HOLD space. Can anyone help me out here?

appreciated.
tt