Below are the functions created using regular expressions to find words or phrases in any plain text file. They were created to find things in plain text BIBLE files. e.g. this function searches a NEW AMERICAN STANDARD Bible plain text file for a word or series of words using grep. The "-i" includes both upper and lower case. the "$*" looks for anything you type after gn - it encapsulates that string in quotes so you don't need to worry about spaces, special characters or upper or lower case. function gn () { grep -i "$*" ~/BIBLES/NAS.txt;} ## NAS - New American Std NOTE: the response for each instance is on one line... I truncated the output with ellipses... --> gn Omega Rev 1:8 "I am the Alpha and the Omega," says the Lord God, "who is and who was and who is to come,... Rev 21:6 Then He said to me, "It is done. I am the Alpha and the Omega, the beginning and the end... Rev 22:13 I am the Alpha and the Omega, the first and the last, the beginning and the end." to "fold" the output to fit your page or screen to 80 characters, you may use: function gnf () { grep -i "$*" ~/BIBLES/NAS.txt | fold -s -w 80;} ## NAS 80 columns the -s folds at a space the -w 80 sets the widest line to 80 characters, you may change this value (default is 80) see: --> fold --help Usage: fold [OPTION]... [FILE]... Wrap input lines in each FILE, writing to standard output. With no FILE, or when FILE is -, read standard input. Mandatory arguments to long options are mandatory for short options too. -b, --bytes count bytes rather than columns -s, --spaces break at spaces -w, --width=WIDTH use WIDTH columns instead of 80 --help display this help and exit --version output version information and exit e.g. --> gnf Omega Rev 1:8 "I am the Alpha and the Omega," says the Lord God, "who is and who was and who is to come, the Almighty." Rev 21:6 Then He said to me, "It is done. I am the Alpha and the Omega, the beginning and the end. I will give to the one who thirsts from the spring of the water of life without cost. Rev 22:13 I am the Alpha and the Omega, the first and the last, the beginning and the end." ################################## john's .bashrc 28 Dec 2017 ################### # the .bashrc file sets useful user configurations related to: # Path, Prompt, Permissions, History, Editor, Alias, Shell options and Functions # http://johnmeister.com/linux/bashrc-basic.html ################################################################################### ### setting these options make life in the shell easier to manage... # SHELL OPTIONS: shopt -s histverify # allows recall historical commands, edit, then use, type: history shopt -s checkwinsize #========================================================================================== ### NOTE: you can place the Bible text files in any directory you'd like, adjust below ### ###################### # FUNCTIONS: # creates a directory structure and changes to the lowest level - be aware of keywords function dir-mkcd () { mkdir -p "$@" && eval cd "\"\$$#\""; } # # functions - ############################################################################### function ge () { grep -i "$*" ~/BIBLES/ENG.txt;} ## NAS-NKJV-KJV function gef () { grep -i "$*" ~/BIBLES/ENG.txt |fold -s -w 80;} ## NAS-NKJV-KJV - folded function ge4 () { grep -i "$*" ~/BIBLES/ENG4.txt;} ## NAS-NKJV-KJV-YLT # functions - ############################################################################### # functions - ### INDIVIDUAL translations: NAS, KJV, NKJV, YLT ###### function gn () { grep -i "$*" ~/BIBLES/NAS.txt;} ## NAS - New American Std function gk () { grep -i "$*" ~/BIBLES/KJV.txt;} ## KJV - KJV function gw () { grep -i "$*" ~/BIBLES/NKJV.txt;} ## NKJV - New KJV function gy () { grep -i "$*" ~/BIBLES/YLT.txt;} ## YLT - Youngs Literal # functions - ############################################################################### # functions - ### NAS folded or wider context ###### function gnf () { grep -i "$*" ~/BIBLES/NAS.txt | fold -s -w 80;} ## NAS 80 columns function gnf100 () { grep -i "$*" ~/BIBLES/NAS.txt | fold -s -w 100;} ## NAS 100 columns function gnf120 () { grep -i "$*" ~/BIBLES/NAS.txt | fold -s -w 120;} ## NAS 120 columns function gn2 () { grep -C 2 -i "$*" ~/BIBLES/NAS.txt;} ## NAS context 2 lines function gn3 () { grep -C 3 -i "$*" ~/BIBLES/NAS.txt;} ## NAS context 3 lines function gn4 () { grep -C 4 -i "$*" ~/BIBLES/NAS.txt;} ## NAS context 4 lines function gn5 () { grep -C 5 -i "$*" ~/BIBLES/NAS.txt;} ## NAS context 5 lines # functions - ############################################################################### # functions - ### NAS and German ### function gnd () { grep -A 1 -i "$*" ~/BIBLES/ND.txt;} ## NAS and German # functions - ################################################# # functions - ### translations with NAS - nkjv, kjv, ylt, dhs and greek ##################### function gsix () { grep -A 3 -B1 -i "$*" ~/BIBLES/SIX.txt;} ## NAS,NKJV,KJV,YLT,DHS,Greek function g6 () { grep -A 3 -B1 -i "$*" ~/BIBLES/SIX.txt;} ## NAS,NKJV,KJV,YLT,DHS,Greek # functions - ################################################# # functions - ### NAS, NKJV, KJV, DHS, GREEK ############################################### function gz () { grep -A 4 -B 2 -i "$*" ~/BIBLES/NkKDG.txt;} ## NAS,NKJV,KJV,DHS,Greek function ga () { grep -A 3 -B 1 -i "$*" ~/BIBLES/NKDG.txt;} ## KJV,NAS,DHS,Greek function gkn () { grep -C 1 -i "$*" ~/BIBLES/KNb.txt;} ## KJV-NAS function gnd3 () { grep -A 5 -B 4 -i "$*" ~/BIBLES/ND.txt;} ## NAS and DHS context 3 function gz-nas-uncited () { grep -A 4 -B 2 -i "$*" ~/BIBLES/ANODG.txt;} ## NAS,NKJV,KJV,DHS,Greek # functions - ##################################################################################### # functions - KJV ### context and MULTIPLE translations with KJV ###### function gk3 () { grep -C 3 -i "$*" ~/BIBLES/KJV.txt;} ## KJV context 3 lines function gknd () { grep -C 3 -i "$*" ~/BIBLES/KND.txt;} ## KJV,NAS,DHS context 3 function gknn () { grep -A 2 -B2 -i "$*" ~/BIBLES/KNN.txt;} ## KJV,NKJV,NAS # functions - ######################################################################################## # functions - ### NAS, NKJV, KJV, DHS, GREEK ####################################################### function ganodg () { grep -A 8 -B 3 -i "$*" ~/BIBLES/ANODG.txt;} ## NAS,NKJV,KJV,DHS,Greek function ganodgl () { grep -A 4 -B 3 -i "$*" ~/BIBLES/ANODG.txt;} ## NAS,NKJV,KJV,DHS,Greek function gnn () { grep -C 1 -i "$*" ~/BIBLES/NN.txt;} ## NAS-NKJV - lines function gnl () { grep -C 1 -i "$*" ~/BIBLES/NNn.txt;} ## NAS-NKJV - no lines function gnnk () { grep -A 2 -B2 -i "$*" ~/BIBLES/NNK.txt;} ## NAS,NKJV,KJV function g3 () { grep -A 2 -B2 -i "$*" ~/BIBLES/NNK.txt;} ## NAS,NKJV,KJV function g4 () { grep -A 2 -B2 -i "$*" ~/BIBLES/NkKD.txt;} ## NAS,NKJV,KJV,DHS function g5 () { grep -A 1 -B1 -i "$*" ~/BIBLES/ANODG.txt;} ## NAS-not-cited,NKJV,KJV,DHS,Greek function g5c () { grep -A 2 -B2 -i "$*" ~/BIBLES/NkKDG.txt;} ## NAS-cited,NKJV,KJV,DHS,Greek # functions - ########################################################################################