User Tools

Site Tools


word_diffs

Word Diffs

When examining changes between releases, I use wdiff to check to see what's changed, so I can manually look over it.

Here's a script I've used:

echo -n > diffs.txt

sqlite3 lds-scriptures-sqlite3.old.db "SELECT verse_id, verse_title, scripture_text from scriptures ORDER BY verse_id LIMIT 1;" | while read line; do

        verse_id=`echo $line | cut -d '|' -f 1`
	verse_text_old=`echo $line | cut -d '|' -f 3`
	verse_text_new=`sqlite3 lds-scriptures-sqlite3.new.db "SELECT scripture_text from scriptures WHERE verse_id = ${verse_id};"`

	if [[ "$verse_text_old" != "$verse_text_new" ]]; then

		echo ${verse_text_old} > /tmp/verse_text.old
		echo ${verse_text_new} > /tmp/verse_text.new

		echo "$verse_title" >> diffs.txt
		echo >> diffs.txt
		wdiff /tmp/verse_text.{old,new} >> diffs.txt
		echo >> diffs.txt

	fi
done

You can see the main query sets a LIMIT 1 in this case, and I'll change it later to do the full thing.

Here's the output of just one:

Genesis 1:1
  
[-IN-]{+In+} the beginning God created the heaven and the earth.

You can see that in the 2013 version, IN was change to In. That was done on all the verses where the first word in each chapter is now normal-cased.

Another one of the main changes that is frequent is changing LORD to Lord.

Genesis 2:4

These are the generations of the heavens and of the earth when they were created, in the day that the [-LORD-] {+Lord+} God made the earth and the heavens,

There's more switches that wdiff can use. Here's another example I use in dokuwiki, where I only want to display what the changed word is and add a prefix and suffix of ** so I can drop the text right in:

dwdiff -y "**" -z "**" -1 /tmp/verse_text.{old,new}

Here's an example of comparing Matthew 5:19 from its KJV verse to the JST changes:

**Whosoever, therefore,** shall break one of these least commandments, and shall teach men **so to do,** he shall **in no wise** be **saved** in the kingdom of **heaven;** but whosoever shall do and teach **these commandments of the law until it be fulfilled,** the same shall be called **great, and shall be saved** in the kingdom of heaven.

And how it appears in DokuWiki:

Whosoever, therefore, shall break one of these least commandments, and shall teach men so to do, he shall in no wise be saved in the kingdom of heaven; but whosoever shall do and teach these commandments of the law until it be fulfilled, the same shall be called great, and shall be saved in the kingdom of heaven.

You could obviously use your own formatting rules to do things like using HTML tags, or your own wiki syntax, etc.

See the wdiff man page for usage information.

word_diffs.txt · Last modified: 2019/03/24 14:28 by steve