March 25, 2005

Finding punctuation in bible text using BBEdit

I've recieved quite a few requests regarding how I used a text editor to create a concordance based upon find patterns in a text. The query:

How do I search for a punctuation mark, since my bible software cannot yet do this?
Here's an example that uses the best Mac text editor, hands down. (Watch the VIM and emacs guys shudder.) BBEdit 8.x is more than you can imagine if you've never seen it, but it is not cheap. I don't think their freeware version, the new TextWrangler, can do this. The process becomes easier and quicker when you write a script to do most of it, but even if you don't have BBEdit, a walk-through might prove helpful.

For this example, I've saved the NRSV New Testament as a text file, in a format where each paragraph is its own verse. Open up the file in BBEdit, then choose menu Search/Find... and then click the Multiple file drawer. If your file is not open, it won't be listed to put a check mark by it. You can instead choose the "Other..." button to navigate to the text file. Then, enter your search criteria (in this case, ?) and find all. Here's the results window:
BBEdit Search Result
Click into the top concordance-like pane, and do a Select All. Copy that. Open a new document, and paste the text. This is your working results.
Notice it has duplicate verse paragraphs, for it lists each verse the number of times that it contains your search criteria. Mat. 5:47 is listed twice because it contains two ?'s. You can eliminate this with a script in the script menu/Duplicate Removal/Kill Dups Reporting Removals. The result reduces from 991 (the number of times "?" occures in the NRSV NT) paragraphs to 831 (the number of verses that contain at least one "?").
Then, if it takes you two presses of a right arrow key to move through the body of the text, there are extra control characters in there. You can see them by enabling "Show Invisibles". Get rid of them by selecting "Zap Gremlins..." from the Text menu.

Finally, to remove the file path and line # info, Do a quick Find/Replace. Open the Find panel again, check the "Use Grep" check box, make sure the Replace field is empty, and enter this GREP search pattern in the Find Field: /Volumes/Archives/Texts/NRSV NT.txt:[0-9]+: (Note that you should replace the file path "/Volumes/Archives/Texts/NRSV NT.txt" with whatever path is showing up in your document, and that there should be two spaces at the end of that search critera.)

That's it; you've got it. Here is the full list of verses with the text included.
And finally, finally. If you only want verse references, do another GREP pattern Find/Replace, finding ([0-9]) [^0-9]+\r and replacing with \1;
Dare I post the results here in the blog? Oh, why not:

Matt. 2:2; Matt. 3:7; Matt. 3:14; Matt. 5:13; Matt. 5:46; Matt. 5:47; Matt. 6:25; Matt. 6:26; Matt. 6:27; Matt. 6:28; Matt. 6:30; Matt. 6:31; Matt. 7:3; Matt. 7:4; Matt. 7:9; Matt. 7:10; Matt. 7:16; Matt. 7:22; Matt. 8:26; Matt. 8:27; Matt. 8:29; Matt. 9:4; Matt. 9:5; Matt. 9:11; Matt. 9:14; Matt. 9:15; Matt. 9:28; Matt. 10:29; Matt. 11:3; Matt. 11:7; Matt. 11:8; Matt. 11:9; Matt. 11:16; Matt. 12:3; Matt. 12:5; Matt. 12:10; Matt. 12:11; Matt. 12:23; Matt. 12:26; Matt. 12:27; Matt. 12:29; Matt. 12:34; Matt. 12:48; Matt. 13:10; Matt. 13:27; Matt. 13:28; Matt. 13:51; Matt. 13:54; Matt. 13:55; Matt. 13:56; Matt. 14:31; Matt. 15:2; Matt. 15:3; Matt. 15:12; Matt. 15:16; Matt. 15:17; Matt. 15:33; Matt. 15:34; Matt. 16:8; Matt. 16:9; Matt. 16:10; Matt. 16:11; Matt. 16:13; Matt. 16:15; Matt. 16:26; Matt. 17:10; Matt. 17:17; Matt. 17:19; Matt. 17:24; Matt. 17:25; Matt. 18:1; Matt. 18:12; Matt. 18:21; Matt. 18:33; Matt. 19:3; Matt. 19:5; Matt. 19:7; Matt. 19:16; Matt. 19:17; Matt. 19:18; Matt. 19:20; Matt. 19:25; Matt. 19:27; Matt. 20:6; Matt. 20:13; Matt. 20:15; Matt. 20:21; Matt. 20:22; Matt. 20:32; Matt. 21:10; Matt. 21:16; Matt. 21:20; Matt. 21:23; Matt. 21:25; Matt. 21:28; Matt. 21:31; Matt. 21:40; Matt. 22:12; Matt. 22:17; Matt. 22:18; Matt. 22:20; Matt. 22:28; Matt. 22:32; Matt. 22:36; Matt. 22:42; Matt. 22:45; Matt. 23:17; Matt. 23:19; Matt. 23:33; Matt. 24:2; Matt. 24:3; Matt. 24:45; Matt. 25:26; Matt. 25:37; Matt. 25:38; Matt. 25:39; Matt. 25:44; Matt. 26:8; Matt. 26:10; Matt. 26:15; Matt. 26:17; Matt. 26:22; Matt. 26:25; Matt. 26:40; Matt. 26:45; Matt. 26:53; Matt. 26:54; Matt. 26:55; Matt. 26:62; Matt. 26:65; Matt. 26:66; Matt. 26:68; Matt. 27:4; Matt. 27:11; Matt. 27:13; Matt. 27:17; Matt. 27:21; Matt. 27:22; Matt. 27:23; Matt. 27:46; Mark 1:24; Mark 1:27; Mark 2:7; Mark 2:8; Mark 2:9; Mark 2:16; Mark 2:18; Mark 2:19; Mark 2:24; Mark 2:25; Mark 3:4; Mark 3:23; Mark 3:33; Mark 4:13; Mark 4:21; Mark 4:30; Mark 4:38; Mark 4:40; Mark 4:41; Mark 5:7; Mark 5:9; Mark 5:30; Mark 5:31; Mark 5:35; Mark 5:39; Mark 6:2; Mark 6:3; Mark 6:24; Mark 6:37; Mark 6:38; Mark 7:5; Mark 7:18; Mark 7:19; Mark 8:4; Mark 8:5; Mark 8:12; Mark 8:17; Mark 8:18; Mark 8:19; Mark 8:20; Mark 8:21; Mark 8:23; Mark 8:27; Mark 8:29; Mark 8:36; Mark 8:37; Mark 9:11; Mark 9:12; Mark 9:16; Mark 9:19; Mark 9:21; Mark 9:28; Mark 9:33; Mark 9:50; Mark 10:2; Mark 10:3; Mark 10:17; Mark 10:18; Mark 10:26; Mark 10:36; Mark 10:38; Mark 10:51; Mark 11:3; Mark 11:5; Mark 11:28; Mark 11:30; Mark 11:31; Mark 11:32; Mark 12:9; Mark 12:14; Mark 12:15; Mark 12:16; Mark 12:23; Mark 12:24; Mark 12:26; Mark 12:28; Mark 12:35; Mark 12:37; Mark 13:2; Mark 13:4; Mark 14:4; Mark 14:6; Mark 14:12; Mark 14:14; Mark 14:19; Mark 14:37; Mark 14:41; Mark 14:48; Mark 14:60; Mark 14:61; Mark 14:63; Mark 14:64; Mark 15:2; Mark 15:4; Mark 15:9; Mark 15:12; Mark 15:14; Mark 15:34; Mark 16:3; Luke 1:18; Luke 1:34; Luke 1:43; Luke 1:66; Luke 2:48; Luke 2:49; Luke 3:7; Luke 3:10; Luke 3:12; Luke 3:14; Luke 4:22; Luke 4:34; Luke 4:36; Luke 5:21; Luke 5:22; Luke 5:23; Luke 5:30; Luke 5:34; Luke 6:2; Luke 6:3; Luke 6:4; Luke 6:9; Luke 6:32; Luke 6:33; Luke 6:34; Luke 6:39; Luke 6:41; Luke 6:42; Luke 6:46; Luke 7:19; Luke 7:20; Luke 7:24; Luke 7:25; Luke 7:26; Luke 7:31; Luke 7:42; Luke 7:44; Luke 7:49; Luke 8:25; Luke 8:28; Luke 8:30; Luke 8:45; Luke 9:9; Luke 9:18; Luke 9:20; Luke 9:25; Luke 9:41; Luke 9:54; Luke 10:25; Luke 10:26; Luke 10:29; Luke 10:36; Luke 10:40; Luke 11:11; Luke 11:12; Luke 11:18; Luke 11:19; Luke 11:40; Luke 12:6; Luke 12:14; Luke 12:17; Luke 12:20; Luke 12:25; Luke 12:26; Luke 12:41; Luke 12:42; Luke 12:51; Luke 12:56; Luke 12:57; Luke 13:2; Luke 13:4; Luke 13:7; Luke 13:15; Luke 13:16; Luke 13:18; Luke 13:20; Luke 13:23; Luke 14:3; Luke 14:5; Luke 14:28; Luke 14:31; Luke 14:34; Luke 15:4; Luke 15:8; Luke 16:2; Luke 16:3; Luke 16:5; Luke 16:7; Luke 16:11; Luke 16:12; Luke 17:7; Luke 17:8; Luke 17:9; Luke 17:17; Luke 17:18; Luke 17:37; Luke 18:7; Luke 18:8; Luke 18:18; Luke 18:19; Luke 18:26; Luke 18:41; Luke 19:22; Luke 19:23; Luke 19:31; Luke 19:33; Luke 20:2; Luke 20:4; Luke 20:5; Luke 20:13; Luke 20:15; Luke 20:22; Luke 20:24; Luke 20:33; Luke 20:41; Luke 20:44; Luke 21:7; Luke 22:9; Luke 22:11; Luke 22:27; Luke 22:35; Luke 22:46; Luke 22:48; Luke 22:49; Luke 22:52; Luke 22:64; Luke 22:70; Luke 22:71; Luke 23:3; Luke 23:22; Luke 23:31; Luke 23:39; Luke 23:40; Luke 24:5; Luke 24:17; Luke 24:18; Luke 24:19; Luke 24:26; Luke 24:32; Luke 24:38; Luke 24:41; John 1:19; John 1:21; John 1:22; John 1:25; John 1:38; John 1:46; John 1:48; John 1:50; John 2:4; John 2:18; John 2:20; John 3:4; John 3:9; John 3:10; John 3:12; John 4:9; John 4:11; John 4:12; John 4:27; John 4:29; John 4:33; John 4:35; John 5:6; John 5:12; John 5:44; John 5:47; John 6:5; John 6:9; John 6:25; John 6:28; John 6:30; John 6:42; John 6:52; John 6:60; John 6:61; John 6:62; John 6:67; John 6:68; John 6:70; John 7:11; John 7:15; John 7:19; John 7:20; John 7:23; John 7:25; John 7:26; John 7:31; John 7:35; John 7:36; John 7:41; John 7:42; John 7:45; John 7:47; John 7:48; John 7:51; John 7:52; John 8:5; John 8:10; John 8:19; John 8:22; John 8:25; John 8:33; John 8:43; John 8:46; John 8:48; John 8:53; John 8:57; John 9:2; John 9:8; John 9:10; John 9:12; John 9:16; John 9:17; John 9:19; John 9:26; John 9:27; John 9:34; John 9:35; John 9:36; John 9:40; John 10:20; John 10:21; John 10:24; John 10:32; John 10:34; John 10:36; John 11:8; John 11:9; John 11:26; John 11:34; John 11:37; John 11:40; John 11:47; John 11:56; John 12:5; John 12:27; John 12:34; John 13:6; John 13:12; John 13:25; John 13:36; John 13:37; John 13:38; John 14:2; John 14:5; John 14:9; John 14:10; John 14:22; John 16:5; John 16:17; John 16:18; John 16:19; John 16:31; John 18:4; John 18:7; John 18:11; John 18:17; John 18:21; John 18:22; John 18:23; John 18:25; John 18:26; John 18:29; John 18:33; John 18:34; John 18:35; John 18:37; John 18:38; John 18:39; John 19:9; John 19:10; John 19:15; John 20:13; John 20:15; John 20:29; John 21:5; John 21:12; John 21:15; John 21:16; John 21:17; John 21:20; John 21:21; John 21:22; John 21:23; Acts 1:6; Acts 1:11; Acts 2:7; Acts 2:8; Acts 2:12; Acts 2:37; Acts 3:12; Acts 4:7; Acts 4:16; Acts 5:3; Acts 5:4; Acts 5:9; Acts 7:1; Acts 7:26; Acts 7:27; Acts 7:28; Acts 7:35; Acts 7:50; Acts 7:52; Acts 8:30; Acts 8:31; Acts 8:34; Acts 8:36; Acts 9:4; Acts 9:5; Acts 9:21; Acts 10:4; Acts 10:21; Acts 10:29; Acts 10:47; Acts 11:3; Acts 11:17; Acts 13:10; Acts 13:25; Acts 14:15; Acts 15:10; Acts 16:30; Acts 16:37; Acts 17:18; Acts 17:19; Acts 19:2; Acts 19:3; Acts 19:15; Acts 19:35; Acts 21:13; Acts 21:22; Acts 21:37; Acts 21:38; Acts 22:7; Acts 22:8; Acts 22:10; Acts 22:16; Acts 22:25; Acts 22:26; Acts 22:27; Acts 23:3; Acts 23:4; Acts 23:9; Acts 23:19; Acts 25:9; Acts 26:8; Acts 26:14; Acts 26:15; Acts 26:27; Acts 26:28; Rom. 2:3; Rom. 2:4; Rom. 2:21; Rom. 2:22; Rom. 2:23; Rom. 2:26; Rom. 3:1; Rom. 3:3; Rom. 3:5; Rom. 3:6; Rom. 3:7; Rom. 3:8; Rom. 3:9; Rom. 3:27; Rom. 3:29; Rom. 3:31; Rom. 4:1; Rom. 4:3; Rom. 4:9; Rom. 4:10; Rom. 6:1; Rom. 6:2; Rom. 6:3; Rom. 6:15; Rom. 6:16; Rom. 6:21; Rom. 7:1; Rom. 7:7; Rom. 7:13; Rom. 7:24; Rom. 8:24; Rom. 8:31; Rom. 8:32; Rom. 8:33; Rom. 8:34; Rom. 8:35; Rom. 9:14; Rom. 9:19; Rom. 9:20; Rom. 9:21; Rom. 9:24; Rom. 9:30; Rom. 9:32; Rom. 10:6; Rom. 10:7; Rom. 10:8; Rom. 10:14; Rom. 10:15; Rom. 10:16; Rom. 10:18; Rom. 10:19; Rom. 11:1; Rom. 11:2; Rom. 11:4; Rom. 11:7; Rom. 11:11; Rom. 11:34; Rom. 13:3; Rom. 14:4; Rom. 14:10; 1Cor. 1:13; 1Cor. 1:20; 1Cor. 2:11; 1Cor. 3:3; 1Cor. 3:4; 1Cor. 3:5; 1Cor. 3:16; 1Cor. 4:7; 1Cor. 4:21; 1Cor. 5:2; 1Cor. 5:6; 1Cor. 5:12; 1Cor. 6:1; 1Cor. 6:2; 1Cor. 6:3; 1Cor. 6:4; 1Cor. 6:6; 1Cor. 6:7; 1Cor. 6:9; 1Cor. 6:15; 1Cor. 6:16; 1Cor. 6:19; 1Cor. 7:18; 1Cor. 7:21; 1Cor. 7:27; 1Cor. 8:10; 1Cor. 9:1; 1Cor. 9:4; 1Cor. 9:5; 1Cor. 9:6; 1Cor. 9:7; 1Cor. 9:8; 1Cor. 9:9; 1Cor. 9:10; 1Cor. 9:11; 1Cor. 9:12; 1Cor. 9:13; 1Cor. 9:18; 1Cor. 9:24; 1Cor. 10:16; 1Cor. 10:18; 1Cor. 10:19; 1Cor. 10:22; 1Cor. 10:29; 1Cor. 10:30; 1Cor. 11:13; 1Cor. 11:15; 1Cor. 11:22; 1Cor. 12:17; 1Cor. 12:19; 1Cor. 12:29; 1Cor. 12:30; 1Cor. 14:6; 1Cor. 14:7; 1Cor. 14:8; 1Cor. 14:9; 1Cor. 14:15; 1Cor. 14:16; 1Cor. 14:23; 1Cor. 14:26; 1Cor. 14:36; 1Cor. 15:12; 1Cor. 15:29; 1Cor. 15:30; 1Cor. 15:32; 1Cor. 15:35; 1Cor. 15:55; 2Cor. 1:17; 2Cor. 2:2; 2Cor. 2:16; 2Cor. 3:1; 2Cor. 3:8; 2Cor. 6:14; 2Cor. 6:15; 2Cor. 6:16; 2Cor. 11:7; 2Cor. 11:11; 2Cor. 11:22; 2Cor. 11:23; 2Cor. 11:29; 2Cor. 12:13; 2Cor. 12:15; 2Cor. 12:17; 2Cor. 12:18; 2Cor. 12:19; 2Cor. 13:5; Gal. 1:10; Gal. 2:14; Gal. 2:17; Gal. 3:1; Gal. 3:2; Gal. 3:3; Gal. 3:4; Gal. 3:5; Gal. 3:19; Gal. 3:21; Gal. 4:9; Gal. 4:15; Gal. 4:16; Gal. 4:21; Gal. 4:30; Gal. 5:7; Gal. 5:11; Eph. 4:9; Phil. 1:18; Col. 2:20; Col. 2:21; 1Th. 2:19; 1Th. 3:9; 2Th. 2:5; 1Tim. 3:5; Heb. 1:14; Heb. 2:3; Heb. 3:16; Heb. 3:17; Heb. 3:18; Heb. 7:11; Heb. 10:2; Heb. 10:29; Heb. 11:32; Heb. 12:7; Heb. 12:9; James 2:1; James 2:4; James 2:5; James 2:6; James 2:7; James 2:14; James 2:16; James 2:20; James 2:21; James 2:25; James 3:11; James 3:12; James 3:13; James 4:1; James 4:4; James 4:5; James 4:12; James 4:14; James 5:13; James 5:14; 1Pet. 2:20; 1Pet. 3:13; 1Pet. 4:17; 2Pet. 3:4; 2Pet. 3:12; 1John 2:22; 1John 3:12; 1John 3:17; 1John 5:5; Rev. 5:2; Rev. 6:10; Rev. 6:17; Rev. 7:13; Rev. 13:4; Rev. 17:7

No comments: