Skip to content

Instantly share code, notes, and snippets.

@F1LT3R
Last active July 9, 2023 01:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save F1LT3R/d1e9ed7c8484512f715756a0f5827b3c to your computer and use it in GitHub Desktop.
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.
# 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