diff --git a/footnote_scripts/1_create_footnotes b/footnote_scripts/1_create_footnotes new file mode 100644 index 0000000..7a58a91 --- /dev/null +++ b/footnote_scripts/1_create_footnotes @@ -0,0 +1,7 @@ +#!/bin/zsh +#first script used to create a file with nicer formatting, here just for Genesis +for chapter in {0..50}; do + for i in {0..50}; do + cat Gen_$chapter.html | grep "fnm$i" | tr '\n' '@' | perl -pe "s/
(.*?)<\/div>/Genesis\tGen\t1\t$chapter\t\1\t\2\*/g" | perl -pe "s///g" | perl -pe "s/
.*?<\/sup> (.*?)<\/div>/\1/" | tr '@' '\n' + done +done diff --git a/footnote_scripts/2_awkscript.awk b/footnote_scripts/2_awkscript.awk new file mode 100644 index 0000000..1bfebc4 --- /dev/null +++ b/footnote_scripts/2_awkscript.awk @@ -0,0 +1,20 @@ +#!/bin/awk +#uses file genereated from 1_create_footnotes to format each line of to be inserted into the final tsv +BEGIN{ +FS="\t" +} +function printline(){ + +if ($2 != "" ){ + book=$1 + abbrev=$2 + bookno=$3 + chapter=$4 + verseno=$5 +} +else { + printf("%s\t%s\t%d\t%d\t%d\t*\t%s\n",book,abbrev,bookno,chapter,verseno,$1) + } +} + +{printline()} diff --git a/footnote_scripts/3_integrate b/footnote_scripts/3_integrate new file mode 100644 index 0000000..829654d --- /dev/null +++ b/footnote_scripts/3_integrate @@ -0,0 +1,16 @@ +#!/bin/zsh +#Adds the footnotes in the right location in the larger tsv file +while read line; do + start_of_line="$(echo "$line" | awk 'BEGIN{FS="\t"}{printf("%s\t%s\t%d\t%d\t%d\t\n",$1,$2,$3,$4,$5)}')" + if grep -q "$start_of_line" notes_formatted; then + count=$( grep "$start_of_line" notes_formatted | wc -l ) + printf '%s' "$line" + for i in {1..$count}; do + printf '*' + done + printf '\n' + grep "$start_of_line" notes_formatted + else + echo "$line" + fi +done