From CrossWire Bible Society
Preparing a text for importing can be a daunting task - particularly for the non-programmer among us. Often we hear hints "just write a short perl script" etc. - tasks which may well appear unsurmountable.
On the page below are various tools and small scripts which might assist one or other in their module creation. You might have to adapt these scripts to your particular situation, but this might be a lot easier than writing something from scratch.
To create ThML cross references out of (<Book> <Chapter>:<Verse>) type references:
sed -e 's/\(\(\([CJKPST]\|[AC-Z]\)[a-z]\+\.\?\)\? *[0-9]\+:[0-9]\+\ \([-,:]\( \?[0-9]\+\)\?\)*\)\([a-z]\|ff\.\)\?\(,.;:)=]\| \ [A-Za-z(=\)/<scripRef passage="\1">\1\6<\/scripRef>\7/g'
Swapping badly formatted references <verse>:<chapter> to <chapter>:<verse> can be done with this script.
sed -e 's/\([0-9]\+\):\([0-9]\+\)/\2:\1/g'
The Windows application TextPipe Standard (available from DataMystic) is a very useful tool for file format shifting and related tasks. This proprietary program is not free, but for the non-programmer, it may be easier to learn to use than writing perl scripts or sed scripts.