Last active
July 9, 2023 01:17
-
-
Save F1LT3R/d1e9ed7c8484512f715756a0f5827b3c to your computer and use it in GitHub Desktop.
Extract text of the Web Bible to chapter directories for easy CLI search w/ ripgrep, ack, etc.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Download bible as text files from: | |
# https://ebible.org/Scriptures/eng-web_readaloud.zip | |
# File output is: Book-Number/Book-Abreviation/Chapter | |
# Eg: 01/GEN/01 | |
mkdir web-bible | |
unzip eng-web_readaloud.zip -d web-bible | |
cd web-bible | |
rm *.asc *.htm *_000* | |
for i in *.txt; do | |
SHORT=$(echo ${i} | sed 's/eng-web_//;s/_read.txt//;'); | |
NUM=$(echo $SHORT | sed 's/_.*//;s/0*//'); | |
BOOKNUM=$(printf "%02d" $(($NUM - 1))); | |
BOOKABV=$(echo $SHORT | sed 's/[0-9]*_//;s/_[0-9]*//'); | |
CHAPTER=$(echo $SHORT | sed 's/[0-9]*_[0-9|A-Z]*_//'); | |
mkdir -p $BOOKNUM/$BOOKABV | |
LINES=$(wc -l < ${i}); | |
tail -n +3 ${i} | head -n$LINES > $BOOKNUM/$BOOKABV/$CHAPTER | |
echo "$BOOKNUM/$BOOKABV/$CHAPTER" | |
done; | |
rm *.txt; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment