Lookup words and verses in the bible (king james version)
bible [-f] [-l columns] [-m memlimit] [-p path-list] [-d datafile-name] [verse-reference(s)]
Bible\^ writes the text of specified Bible verses to stdout. The text used is the Authorized (King James) version. Commands may be given either on the command line, or interactively. Bible\^ also supports instant searches for verses containing a particular word, or combination of words. The program uses a specially-compressed form of the text that allows for rapid random access, while still compressing the original 4.4 Mbyte text into less than 1.8 Mbytes (plus the "concordance" data file, which requires nearly 900 Kbytes).
The options to bible\^ are:
Toggles special output formatting (pretty-printing). By default, pretty-printing is on\^ (a change from earlier versions). When pretty-printing is off\^, bible\^ precedes each verse with its book/chapter/verse reference. When pretty-printing is on\^, the book name and chapter are printed on a line by themselves, and only when the chapter or book changes. The start of each verse is indented and preceded by the verse number. The book and chapter names are separated from the text by blank lines to facilitate post-processing by other tools such as adjust. Pretty-printing activates automatic line breaks ( -l)
When pretty-printing is off, bible\^ prints one verse per line, even though the text may be much longer than will fit on a single line of a display. This is very handy when the output will be processed by other programs, but it doesn't look very nice. The -l option sets a limit on the length of an output line, causing bible\^ to break lines (only between words) to fit. The columns argument is optional; if it is not specified, bible\^ will use the value of the COLUMNS environment variable minus one. If COLUMNS is not set a default value of 79 is used.
Bible\^ normally allocates up to 1 megabyte for buffers to store uncompressed text. If the -m option is present, bible\^ will set the limit to memlimit kilobytes.
Bible\^ normally searches for the text data file first in the current directory, and then in /usr/lib. The -p option may be used to change the search path. Path-list should be a list of directories, each separated by a space (be sure to escape them from the shell).
Bible\^ normally expects to find the text data in a file named bible.data, and the concordance data in bible.data.conc. If the -d option is present, bible\^ will look for a text data file named filename, and a concordance data file named filename.conc instead.
Bible\^ accepts verse references in a variety of forms, including single verses and verse ranges. For example:
Jn3:16, john3:16,17 ps1:1-6
Most recognizable abbreviations are allowed, and spelling errors are ignored if the book can be made out in the first few characters. No distinction is made between upper and lower case. Multiple references may be provided on an input line, delimited by spaces or commas.
Verse and chapter will be silently coerced into a realistic range, e.g. "Ps1:87" will be treated as Psalm 1:6 since there are only six verses in Psalm 1, and "Rev99:99" will be treated as Revelation 22:21 (the last verse in the Bible). A book name by itself is assumed to be a reference to chapter 1, verse 1 of that book, i.e. "Acts" is the same as "Acts1:1". Similarly, a book and chapter without a verse is assumed to refer to verse one of that chapter.
A range of verses may be printed by giving a starting and ending reference, separated by a hyphen ("-"). For example, "Gen1:1-Rev22:21" will dump the entire text (about 4.4 MB).
Bible\^ keeps track of your current context and will attempt to interpret references in that context. For example if you request "John1:1", followed by "3:16", and then "17", the second reference is assumed to be within the book of John, and the third is assumed to be within chapter 3 of that book. An empty reference, e.g. a blank line on the input, will show the next verse following the last one displayed.
More examples of legal verse references:
Romans3:23 5:8 6:23
Bible\^ includes a concordance, with which you can immediately find all the verses in which a word appears. The ??word command will select all the references that include word. Bible will display the number of matching references, if any, but since the number could be quite large, it won't actually list the references until you ask.
In order to list the references from a word search, the ?list (or ?l) command is used. Likewise, to print the full text of the verses selected by a word search, use the ?view (or ?v) command.
The lists for multiple words may be combined using the ?and word and ?or word commands. First create a reference list using the ?? command. For example,
will find 231 references to the word "faith". To narrow the list further, the command
will inform you that, while there were 281 references to "love", only 16 of them were also in the previous reference list (i.e. contained both words). The "combined list" of 16 references produced by the ?and word command is the intersection of the two lists, and replaces the original reference list.
The ?list and ?view commands will now apply to the combined list. You can continue to apply the ?and command to the combined list. For example,
will further narrow the combined list to only two references. Typing ?view then displays the full text:
1 Thessalonians 1
3 Remembering without ceasing your work of faith, and labour of love, and patience of hope in our Lord Jesus Christ, in the sight of God and our Father;
1 Thessalonians 5
8 But let us, who are of the day, be sober, putting on the breastplate of faith and love; and for an helmet, the hope of salvation.
The ?or word command is similar to ?and, but it produces a combined reference list that is the union of the two lists. In other words, the list includes those verses in which either of the words appears. For example
??angels ?or angel
will find all 283 verses in wich either word is used.
By default, reference lists cover the entire Bible. But for those times when it is useful to limit them to a particular section of the text, bible provides the ?in verse range command. For example
will limit future reference lists to the New Testament. If you have a current reference list, references that fall outside the limits will be dropped. Note that only a contiguous range of verses may be used. To reset the limits so that the whole text is searched, the command is ?in all.
For interactive use, invoke bible\^ without any verse references on the command line. You should see a prompt displayed:
Typing ? will print a command summary.
The program accepts three types of interactive command input:
Bible verse references, as described above.
Concordance (word search) commands, also described above. These commands are: ??, ?list, ?view, ?and, ?or, and ?in.
Miscellaneous program control commands:
?, ?h, ?help
Prints help text.
Toggles output formatting modes.
Begin writing program output to a file. If file exists, output is appended to what's there already.
Stop writing to a file.
Toggle the direction (forward or backward) in which bible will move through the text when a blank line is entered.
\q, ?bye, ?exit, ?quit, ?q
End the program.
References to the one-chapter books of Philemon and 3 John are non-standard in that they require a dummy chapter number. For example, use Phm1:5 instead of Phm5 to get verse 5.
The possessive form 's is handled strangely by the Concordance. The apostrophe has been removed and the s has been treated as if it were a separate word. So, for example, if you wanted to find all references to "refiner's" you would have to first search for "refiner" (using the command ??refiner) and then combine it with a search for "s" (?and s).
The convention for handling partial verse specifications can be clumsy. A book name by itself, e.g. "Matthew" is taken as a reference to verse 1:1 of that book. So ?in matt results in a range limit of a single verse (Mt1:1) instead of the whole book as one might hope. Similarly, ?in mt-rev results in a range of Matthew 1:1 to Revelation 1:1, instead of extending all the way to Revelation 22:21.
Chip Chapin, Hewlett Packard Company ([email protected]).
The current version uses Lempel-Ziv-Welch compression on the data file, though I modified the "compress" program to emit checkpoints at known intervals to facilitate random access to the data. I call this simple technique "windowed compression", and it could be used for any similar application. The data file can still be uncompressed using the standard "compress" utility if my file header is removed.
I would like to gratefully acknowledge the contribution of the authors of the compress program, which I modified for use in the text storage component of bible. As listed in the compress sources they are: Spencer W. Thomas, Jim McKie, Steve Davies, Ken Turkowski, James A. Woods, Joe Orost.
Matthew Vernon <[email protected]> has substantially updated a the code of this package. His alterations are made available under the terms of the GNU General Public Licence, version 2 or later, as published by the Free Software Foundation.