#!/bin/sh
#] 
#] *********************
#] $ bash "$d_bin"'pdftotext_archive_searchDir.sh' - pdf2text then [list, search] Puetz newsletters
# www.BillHowell.ca  05Oct2022 initial 
# view in text editor, using constant-width font (eg courier), tabWidth = 3


#************************
# List of operators, generated with :
# $ grep  "^#]"  bash "$d_bin"'pdftotext_archive_searchDir.sh'  |  sed "s/^#\]/  /" 
#




#************************
# Setup 

source  "$d_bin""standard header.sh"

#  convert pdfs in a directory to text, same fnames. Make sure only functions defined, but not activated :
source  "$d_bin""pdfToText directory.sh"  

searchTxt="eclipse"						#  also used [markets, 


#************
# code 

#] newsletterL()  - list of newsletters including archives 
# 		 doesn't "reach into" body of pdf for search

	newsletterL()
{  
	find  "$d_PROJECTS"'Investments/Puetz newsletter/'  -type f  -name "*"  |   tr  \\n  \\0  |  xargs -0  -IFILE  grep  --with-filename  --line-number  "markets"  "FILE"  >"$d_web"'Projects - mini/PuetzUWS/0_Puetz newsltr TblOfContents.txt'
}

05Oct2022 VASTLY INCOMPLETE!!!

#] pdftotext_archive_search()  - 

	pdftotext_archive_search()
{  
	find  "$d_PROJECTS"'Investments/Puetz newsletter/'  -type f  -name "*.pdf"  |   tr  \\n  \\0  |  xargs -0  -IFILE  grep  --with-filename  --line-number  "$searchTxt"  "FILE"  |  mv  
	find  "$d_PROJECTS"'Investments/Puetz newsletter/'  -type f  -name "*"  |   tr  \\n  \\0  |  xargs -0  -IFILE  grep  --with-filename  --line-number  "$searchTxt"  "FILE"  |  sed 's#.*\(.*\)/#\1#'  |  sort  >"$d_web"'Projects - mini/PuetzUWS/0_Puetz newsltr TblOfContents.txt'
}  


#	find  "$d_PROJECTS""Investments/Puetz newsletter/pdfToText/"  -type f  -name "*"  |   tr  \\n  \\0  |  xargs -0  -IFILE  grep  --with-filename  --line-number  "eclipse"  "FILE"  |  sed 's#.*\(.*\)/#\1#'  | sort





#*******************************************************************************
# Procedures -  To run :



#************
# run - select one of options

	newsletterL  
# 	search  


# $ bash  "$d_bin"'0_form bash.sh.txt'  

# enddoc
