First day back at work today so time to get my geek on. I now know that the Bible (*) has 1189 chapters. Furthermore, I didn’t derive that figure by laboriously counting them by hand but I set a computer to work to figure out the answer. In fact, that was a trivial task (wc -l booklist.txt
) using a standard Linux command line tool; what took more work was deriving the book list in the first place.
I started with a Google search for bible books and chapters
and the first link, to a listing of all the books and chapters of the NIV version on the BibleGateway site, was ideal. That gave a tabular result, with book names in column one and chapter numbers in column two. Copying and pasting this into a text file showed that there was a space and a tab after the book name and a space between each chapter number. I used vim to simplify that space and tab to a tab (%s/ \t/\t/
) but realised that the task was complicated by the fact that some book names include spaces (such as 1 Corinthians) so it was time to break out a proper programming tool.
My choice was Python and I used the iPython3 program to interactively work up a short script. The resulting code (reading from a file called biblebooks.txt
and outputting to booklist.txt
) was as follows:
bbdata = open('biblebooks.txt','r').read().strip().split('\n') bl = open('booklist.txt','w') for line in bbdata: book = line[:line.find('\t')] chapters = line[line.find('\t') + 1:] for chapter in chapters.split(): bl.write('unread\t{} {}\n'.format(book,chapter)) bl.close()
The result was a list that looks like:
unread Genesis 1
unread Genesis 2
…
unread Revelation 22
which I have pasted into Evernote. I can now use this to keep tabs on what I have read (by deleting “un” from the chapters covered). The structured format also means I can easily copy and paste back into a Linux environment if I want to get a report on my progress. In the past I have used a sequential reading list (just the New Testament last year and the whole Bible the year before that and in several previous years) but the advantage of this method is that I can mark in everything that comes in via following a Daily Office, attending church services and other sources to help me cover all the ground and limit the patches when I try to speed read chunks just to keep up with the plan.
(*) Standard Protestant edition, such as the NIV or NASB, so no deuterocanonical or further apocryphal material included
2 Comments
Leave a reply →