Thread: Regex examples
View Single Post
Old 07-03-2012, 07:06 AM   #104
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
I don't know about Sigil, but this is what I do in vim:

I use a special symbol (¬, |, ¦ are useful for this) where I want the consecutive numbers:

Code:
<a href="../Text/scriptures.html#scrip¬" id="backscrip¬">This text is a link</a>
Once I have all the links like that, I run this command in vim:

Code:
: let n=1 | g/¬/s/¬/\=n/g | let n+=1
which replaces all ¬ in a line with the number n, and n is incremented by one every time a line with ¬ is found.
Jellby is offline   Reply With Quote