#!/bin/sh
#] 
#] *********************
#] $ bash "$d_fileops"'fileops run.sh' - run specific cases of fileops.sh functions
# www.BillHowell.ca  01Mar2023 initial 
# view in text editor, using constant-width font (eg courier), tabWidth = 3



# backups see "$d_bin"'wrkSpc/0_wrkSpcL_arcArch.sh'
#24************************24



#************************
# List of operators, generated with :
# $ grep  "^#] "  "$d_fileops"'fileops run.sh' |  sed "s|^#] |#\t|"  >"$d_fileops"'fileops run.sh'' TblOfCont.txt'
#  
#  *********************




# find active run functions: 
# $ grep  "^[ 	]*[A-Za-z0-9_]\+[ 	]\+.*#"  "$d_fileops"'fileops run.sh'
# note 	use of tab key in grep search expression
# func defs come BEFORE 'titleLine capture for TableOfContents: 
#		uncomment (delete '#]') of titleLine to run choice, BUT put back later!

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

#	source  "$d_bin""standard header.sh"	# not here - done by fileops.sh
source  "$d_fileops""fileops.sh"

p_log="$d_fileops"'pLog fileops run.sh'

#	A variety of 'fileops run' bash scripts are in project directories, where it is perhaps easier to see the [data, intermediate results, etc] for scripts in the context of that project.
#	
#	A major reason for creating these "fileops run *.sh" files was to have a description of [manual, script] combinations of steps for a specific process.   This should be enormously helpful [say, month, year]s later when the process has to be : [repeat, modify, used elsewhere].
#	
#	Here is a listing of 'fileops run' bash scripts, built by : 
#	$ find "$d_web"  -type f  -name "fileops *run*.sh*"  |  sort  
#	"$d_web"'bin/0_test/fileops/fileops test run.sh
#	"$d_web"'bin/bin logs/fileops run Grossberg imageCaptions log.sh
#	"$d_web"'bin/fileops run.sh
#	"$d_web"'bin/fileops run webSite loPriority.sh
#	"$d_web"'bin/fileops run webSite template.sh
#	"$d_web"'bin/fileops run webSite update local.sh
#	"$d_web"'bin/fileops tests run.sh
#	"$d_web"'bin/z_Archive/fileops run webSite 240107 20h41m22s.sh
#	"$d_web"'Neural nets/consciousness/webWork/z_Archive/fileops run TrNN_ART.sh
#	"$d_web"'Neural nets/Grossberg/webWork/z_Archive/fileops run TrNN_ART.sh
#	"$d_web"'Neural nets/Transformer NNs/z_Archive/webWork/z_Archive/fileops run TrNN_ART.sh
#	"$d_web"'Neural nets/TrNNs_ART/webWork/z_Archive/fileops run TrNN_ART.sh

# fix function definition comment line (see "$d_SysMaint""text processors/geany notes.txt")
# geany regexpr  search  '^#\] ([A-Za-z0-9_]+)\(([A-Za-z0-9_ ,]+)\) '		replace  #] \1      #(\2)
# geany regexpr  search  '^#\] (.*)[\t]\+'											replace '#] \1   '
# geany regexpr  search  '^#\] ([A-Za-z0-9_]+)\(\) '								replace  #] \1      #()

# add '_run' to descriptor : 
# geany regexpr  search  '^#\] ([A-Za-z0-9_]+) '									replace '#] \1_run '


# 08********08
#] +-----+
#] coding tools

#] test_output					 			#(standrd  result) 

	test_output()
{
	becho  "stndrd=  $1"
	becho  "result=  $2"
	if  [ "$2" ==  "$1" ]; then  becho  "     OK";  else  becho  "     WRONG!";  fi  
}

#] code_get									#(no args) [symbol, function] codes: list all being used
#]    to check against new random codes


#] code_make								#(fractionSeed) new [symbol, function]s: generate [new, unique] code 


#] +-----+
#] path[,L] - check HowellLibrarys for (optrName  arg1  arg2) based on " IS OP  " definitions   

#] fNdfL_subDirRef_argOrderNum_dout_run	#() extract list of uses of each of pthOptrNamL 
	fNdfL_subDirRef_argOrderNum_dout_run()
{  
	echo ''  >/dev/null
# test one optrNam 
# fNdfL_subDirRef_argOrderNum_dout  "$d_Qndfs"  '7_HowellCoreLib list 1 ndf only.txt'  'arrays'  "$d_libWork"  

# all '7_HowellCoreLib list.txt' 
# fNdfL_subDirRef_argOrderNum_dout  '7_HowellCoreLib list.txt'  'arrays/'  
}  


#] fSrc_pStrUse_appendTo_pSrcChk_run	#() redistributes strUse from-str-to-Src basis  
	fSrc_pStrUse_appendTo_pSrcChk_run()
{  
	echo ''  >/dev/null
# fSrc_pStrUse_appendTo_pSrcChk  "$d_libStrUseRaw"'ary_sub_splitSeparate_subL usage.txt'  "$d_libSrcChk"'strings- testGroupsCluster.ndf argOrderNum toCheck.txt'

# 17Feb2023 examples
# $ pinn_strOld_strNew_replace  

# olde code
#			echo "$fnam448"
#			echo "$dirr448"
#		fnam448=$( pth_get_fname    "$pinn448" )
#		dirr448=$( pth_get_dir      "$pinn448" )
# printf option '%s\n' 

# CLI approach : 
# Search [ndf, txt] files in d_Q[root, ndfs, test] for [strings, [optr,var] symbols, etc] : 
#	find "$d_web"  -maxdepth 5  -type f  -name "*.html"  |  grep  --invert-match  "z_Old"  |  grep  --invert-match  "z_Archive"  |  grep  --invert-match 'code develop_test'  |  sort  |  tr  \\n  \\0  |  xargs -0  -IFILE  grep  --with-filename  --line-number  "$strSearch372"  "FILE"  |  sed  's|:.*:.*||'  |  sort  -u  >"$pout448"
}  


#] dir_fextn_pthLExclud_findPthL_pout_run	#() find str in files with fextn in dir, results to pout
	dir_fextn_pthLExclud_findPthL_pout_run()
{  
	echo ''  >/dev/null
# example from past used on command line 
# $ find  "$d_Qndfs"  -type f  -name "*.ndf"  |  grep  --invert-match "z_Old\|z_Archive\|webSite maintain \|file_ops.ndf"  |   tr  \\n  \\0  |  xargs -0  -IFILE  grep  --with-filename  --line-number  "path_exists" "FILE"  |  sed  's|/media/bill/Dell2/Website - raw/Qnial/MY_NDFS/||'  >"$d_temp""path_exists in Qndfs.txt"  

# dir_fextn_pthLExclud_findPthL_pout  "$d_Qndfs"  '*.ndf'  'path_exists'  'z_Old\|z_Archive\|webSite maintain \|file_ops.ndf'  "$d_temp"'path_exists in Qndfs.txt' 
}  
  
  
#] dirSrc_fbase_fxtn_str_appendTo_pStrUse_run	#() append list of uses of optrNam 
	dirSrc_fbase_fxtn_str_appendTo_pStrUse_run()
{  
	echo ''  >/dev/null
# strInn="banana"
# strOut="apple"
# cmd="s/\(.*\):(.*):(.*)/$strOut/" 
# echo "$cmd"
# sed  '"'s/\(.*\):(.*):(.*)/'"$strOut/"' '"'$strInn'"'

# dirSrc_fbase_fxtn_str_appendTo_pStrUse  "$d_Qndfs"  'arrays'  '.ndf'  'ary_idx_get_itm'  
} 


#] +-----+
#] [dir, pth] basic functions 

#] pth_get_dir_run							#(pth) retrieve dir holding pth, dir must exist or error
	pth_get_dir_run()
{   
	local  result=''
	local  stndrd=''

	date_ymdhms=$(date +"%0y%0m%0d %0kh%0Mm%0Ss")
	becho  ''
	becho  '+-----+'
	becho  "pth_get_dir_run, $date_ymdhms"

	result=$( pth_get_dir  "$d_Qndfs"'arrays (copy).ndf' )
	stndrd="$d_Qndfs"
	test_output  "$stndrd"  "$result"  

}  


#] pth_get_dArchive_run						#(pth) returns dArc for pth
	pth_get_dArchive_run()
{   
	local  result=''
	local  stndrd=''

	date_ymdhms=$(date +"%0y%0m%0d %0kh%0Mm%0Ss")
	becho  ''
	becho  '+-----+'
	becho  "pth_get_dArchive_run, $date_ymdhms"

	result=$( pth_get_dArchive  "$d_Qndfs"'arrays (copy).ndf' )
	stndrd="$d_Qndfs"'z_Archive/'
	test_output  "$stndrd"  "$result"  

}  


#] pth_get_pArcDate_run						#(pth) of form "$dArc$fNoX archive.$fExt", creates dArc if required
# ?date? initial, 05May2025 modified initial - poor choice of examples, will change with time!!
# must put these in 0_test files!

	pth_get_pArcDate_run()
{  
	local  result=''
	local  stndrd=''

	date_ymdhms=$(date +"%0y%0m%0d %0kh%0Mm%0Ss")
	becho  ''
	becho  '+-----+'
	becho  "pth_get_pArcDate_run, $date_ymdhms"
	becho  'Warning: Should use files that are stable (eg 0_test files?).'

	becho  ''
	result=$( pth_get_pArcDate  "$d_Qroot"'0_test/arrays atomic/arrays atomic- testOptrs.ndf' ) 
	stndrd="$d_Qroot"'0_test/arrays atomic/z_Archive/arrays atomic- testOptrs 240329 12h09m52s.ndf'
	test_output  "$stndrd"  "$result"  


}


#] pth_get_pArcArch_run	 					#(pth) returns pArc for pth, or 0 for error, assuming archive is dated
# ?date? initial, 05May2025 modified initial
	pth_get_pArcArch_run()
{  
	local  result=''
	local  stndrd=''

	date_ymdhms=$(date +"%0y%0m%0d %0kh%0Mm%0Ss")
	becho  ''
	becho  '+-----+'
	becho  "pth_get_pArcArch_run, $date_ymdhms"

	becho  ''
	result=$( pth_get_pArcArch  "$d_Qndfs"'arrays atomic.ndf' ) 
	stndrd="$d_Qndfs"'z_Archive/arrays atomic archive.ndf'
	test_output  "$stndrd"  "$result"  
}  


# check for bytes for large files : 
# $ ls -l "$d_webRawe"'Bill Howells videos/120214 Venus et Mars, au dela d une histoire d amour/Mythology.ogv'  |  sed 's|^\([rwx-]*\) \([0-9]*\) \([a-zA-Z]*\) \([a-zA-Z]*\) \([0-9]*\) \([a-zA-Z]*\) \(.*\) \(.*\) \/\(.*\)|\5|'  

# $ ls -l "$d_libWork"'arrays/raw/ary_idx_get_itm usage.txt'  |  sed 's|^\([rwx-]*\) \([0-9]*\) \([a-zA-Z]*\) \([a-zA-Z]*\) \([0-9]*\) \([a-zA-Z]*\) \(.*\) \(.*\) \/\(.*\)|\5|' 


#] pthL_fsizCompare_optr_process_run	#(pth fsizeCompare optr)optr pthL based on fSizes (bytes)
	pthL_fsizCompare_optr_process_run()  
{  
	echo ''  >/dev/null
# pthL_fsizCompare_optr_process  "$d_libWork"'arrays/pStrPL optrNamL/pthLraw.txt'  ' -le  1400 '  ' echo '  
# /media/bill/Dell2/Website - raw/Qnial/MY_NDFS/QNial [symbol, arg] changes/arrays/raw/ary_slc_to_idxA usage.txt
# /media/bill/Dell2/Website - raw/Qnial/MY_NDFS/QNial [symbol, arg] changes/arrays/raw/ary_slcA_to_idxAA usage.txt
# /media/bill/Dell2/Website - raw/Qnial/MY_NDFS/QNial [symbol, arg] changes/arrays/raw/ary_to_atmL usage.txt
# /media/bill/Dell2/Website - raw/Qnial/MY_NDFS/QNial [symbol, arg] changes/arrays/raw/ary_idx_get_itm usage.txt
# OK - works!!
}  


#] pSortedL_rename_as_intL_run			#() required by ffmpeg to produce video from pImages @ same format
	pSortedL_rename_as_intL_run()
{
	#pSortedL_rename_as_intL  d_imageL   d_imageTmp   p_imageL
	pSortedL_rename_as_intL  "$d_web"'My sports & clubs/natural- Suspicious/videos SOHO/240701-240804 images/'  "$d_temp"'imageL/'  '0_pImageL.txt'
} 



#] +-----+ 
#] SAFE [backup, restore] cart [pth, dir]s

#] pinn_arcArch							#(pInn) NORMAL backup of form "$dArc$fNam archive.$fext", 
	pinn_arcArch_run()
{  
	pinn_arcArch  "$d_fileops"'fileops.sh'
}



#] +-----+
#] timestamp changes - all time, dates are Unix timevalue unless otherwise specified


#] pinn_timeModTo_timeUnix_run 				#(tMod) for lftp uploads, mods only when file [change, update]d?? 
	pinn_timeModTo_timeUnix_run()
{
	pinn_timeModTo_timeUnix  "$1"
}


#] pMain_strPthStrt_put_pOut_run			#(strPthStrt, pMain, pOut)  replace line strPthStrt with pOut 
#]    strPth must not use ANY "sed delimiters", eg strPth "#|pth " will ruin 's|||'
# Howell default strPthStrt="#!pth "
# 07Feb2025 initial based on pInnL_pChrP_get_pOut()

	pMain_strPthStrt_put_pOut_run()
{  
	dLttr="$d_PROJECTS"'Personal/241115 IDtheft/registeredLetters/'
	pMain="$dLttr"'250201 coreFraud [finance, purchase] suppliers, registered letter.html'  
	pTemp="$d_temp"'pMain_strPthStrt_put_pOut_run pTemp.html'  

#	org='Apple'
#	org='Equifax'
#	org='GoFundMe'
#	org='Google'
#	org='Microsoft'
#	org='Patreon'
#	org='PayPal'

	sed  "s|org addr\.html|$org addr.html|;s|org comment\.html|$org comment.html|"  "$pMain"  >"$pTemp"
	# not a run item!: "#!pth " 
	pMain_strPthStrt_put_pOut  "#!pth "  "$pTemp"  "$dLttr$org"' letter.html'  
}


#] pinnL_pSedExpL_get_povr_run_bag		#(dWork pinnL povr p_log) find sedExpr quotes in pinnL 
# 26Jun2025 initial, setup for pHowAllL956 

	pinnL_pSedExpL_get_povr_run_bag()
{
	# 26Jun2025 
	local dWork="$d_webWork"
	local pinnL="$dWork"'pHoAllL.txt'
	local pSedL="$dWork"''
	local  povr="$dWork"''
	p_log="$dWork956"'pLog pinnL_pSedExpL_get_povr_run.txt'		# no [local, symbol code], because of need for 'becho' etc

} 


#] +-----+ 
#] pinnL mv (rename) according to [fNameOld, fNameNew, 

#] pinnL_pSedExpL_get_povr_run			#(dWork pinnL povr p_log) find sedExpr quotes in pinnL 
# 26Jun2025 initial, setup for pHowAllL956 

	pinnL_pSedExpL_get_povr_run()
{  
	local dWork="$d_webWork"
	local pinnL="$dWork956"'pHoAllL.txt'
	local pSedL="$dWork956"''
	local  povr="$dWork956"''
	p_log="$dWork956"'pLog pinnL_pSedExpL_get_povr_run.txt'		# no [local, symbol code], because of need for 'becho' etc

	pinnL_pSedExpL_get_povr  "$dWork"  "$pinnL"  "$pSedL"  "$povr"  "$p_log"  
}


#] pinn_pOld_pNew_replace_run				#() test code only, don't use normally!   ??? where is ndf?
	pinn_pOld_pNew_replace_run()
{  
	echo ''  >/dev/null
# 28Feb2023 tests 
# 01Mar2023 only to test lineLOld146=( "$pOld146"* ), and to prinout line sequence
# 	pinn_pOld_pNew_replace  1  "$d_vidHowell"'Birkeland rotation in galaxy - not dark matter/Birkeland rotation in galaxy - not dark matter.html'  "$d_webWork"'urls non-[conference guides] pLst test bag.txt'  "$d_webWork"'phead status new.txt'  

 	pinn_pOld_pNew_replace  1  '/home/bill/web/Bill Howells videos/Birkeland rotation in galaxy - not dark matter/Birkeland rotation in galaxy - not dark matter.html'  '/home/bill/web/webWork/phead_one old.txt'  '/home/bill/web/webWork/phead_one new.txt' 

}  


#] pinnL_pOldNewPL_replace_run			#()   ??? where is ndf?
	pinnL_pOldNewPL_replace_run()
{  
	echo ''  >/dev/null

# 01Mar2023 all worked well! 
	
#	pinnL_pOldNewPL_replace  1  "$d_webWork"'pinnL heads test one.txt'  "$d_webWork"'pOldNewPL heads.txt'  
	
#	pinnL_pOldNewPL_replace  1  "$d_webWork"'pinnL heads test bag.txt'  "$d_webWork"'pOldNewPL heads.txt'  

	pinnL_pOldNewPL_replace  1  "$d_webWork"'pinnL heads test rest.txt'  "$d_webWork"'pOldNewPL heads.txt'  
}  



#] +-----+ 
#] [extract, replace] strings in pinnL

#] pinnL_str_extractPthLWithStr_pout_run	#() grep 'st' --with-file-name, lineNum

	pinnL_str_extractPthLWithStr_pout_run()
{
	# 14Nov2025: 
	pinnL_str_extractPthLWithStr_pout  "$d_webWork"'pHtmNwpL.txt'  '/home/bill/web/'  "$d_webWork"'pHtmNwpL with links.txt'
}


#] pinnL_pStrL_getPthsWithOUTstrL_pout_run		#() paths of pinnL withOUT str

	pinnL_pStrL_getPthsWithOUTstrL_pout_run()
{
	# 14Nov2025: 
	pinnL_pStrL_getPthsWithOUTstrL_pout  "$d_webWork"'pHtmNwpL.txt'  "$d_webWork"'pHtmNwpL noStrL.txt'  "$d_webWork"'pHtmNwpL no links.txt'
}


#] pinnL_str_extractCountPathsWithStrTo_pout_run	#() txtLines with str of pinnL
	pinnL_str_extractCountPathsWithStrTo_pout_run()
{  
	echo ''  >/dev/null
# find webPageHtml files with linkErrors
# OK, I don't need more examples : just change the linkError str below : 
# pinnL_str_extractCountPathsWithStrTo_pout  "$d_webWork"'webSite webPageList.txt"  '!!linkError!!Climate and sun/Laskar etal model for solar insolation in QNial programming language'  "$d_temp""pinnL_str_extractCountPathsWithStrTo_pout temp.txt"  
}  


#  povrL_pStrP_replace_run_bag			#(no args) old runs
# 19Jan2024 initial

	povrL_pStrP_replace_run_bag()  
{
	# +-----+
	pOvrL="$d_temp"'povrL_pStrP_replace_run pOvrL.txt'
	pStrPL="$d_temp"'povrL_pStrP_replace_run pStrPL.txt'
	echo  'ProjMini/Kaal- Structured Atom Model	ProjMajor/Electric Universe/Kaal SAM nucleus'  >"$pStrPL"

	find "$d_projMaj"'Electric Universe/Kaal SAM nucleus/'  -type f  \( -name "*.txt" -o -name "*.html" \)  |  grep  --invert-match  "z_Old"  |  grep  --invert-match  "z_Archive"  |  sort  >"$pOvrL"
	povrL_pStrP_replace  1  1  "$pOvrL"  "$pStrPL"  

	find "$d_projMin"'Kaal- Structured Atom Model/'  -type f  \( -name "*.txt" -o -name "*.html" \)  |  grep  --invert-match  "z_Old"  |  grep  --invert-match  "z_Archive"  |  sort  >"$pOvrL"
	povrL_pStrP_replace  1  1  "$pOvrL"  "$pStrPL"  

	pOvrL="$d_Qroot"'240307 pNdfL for [types, arrays]x[, - testOptrs].ndf.txt'
	pStrPL="$d_Qroot"'240307 pStrP for [types, arrays]x[, - testOptrs].ndf.txt'
	echo  'changes for [types, arrays]x[, - testOptrs].ndf'
	povrL_pStrP_replace  1  1  "$pOvrL"  "$pStrPL"  

}


#] povrL_pStrP_replace_run					#(bolArXiv bolChrCd povrL pStrP) sed replace encoded (pStrP, povrL)
# 19Jan2024 initial

	povrL_pStrP_replace_run()  
{
	# +-----+
	# 20May2025 link-list for long substitution of environmental variables : 
	#		'Bill Howells book [note, review]s/0_Howell [note, review]s of other peoples work.html'
	pLnkRaw="$d_temp"'Howells book [note, review]s raw links.txt'
	pLnkPth="$d_temp"'Howells book [note, review]s fulPth.txt'
	pStrPL="$d_temp"'pStrPL envVars.txt'
	povrL="$d_web"'Bill Howells book [note, review]s/1_povrL.txt'
	find  "$d_web"'Bill Howells book [note, review]s/' -type f -name  "*.link.txt"  |  sort  |  tr  \\n  \\0  |  xargs -0 -IFILE  grep  '\"\$'  "FILE"  |  sed 's|.*\"\$\(.*\)|"$\1|'  |  tr  "'"  '"'  |  sed 's|\"\$\(.*\)\"\"\(.*\)\/\(.*\)\"|<LI><A HREF="\1\2\/\3">\n\t\3<\/a>|'  >"$pLnkRaw"
	cp  -p  "$pLnkRaw"  "$pLnkPth"  
	env  |  grep '^d_'  |  sort  |  tr  '='  \\t  >"$pStrPL"
	#povrL_pStrP_replace					#(bolArXiv bolChrCd povrL pStrP) sed replace encoded (pStrP, povrL)
	#normally set [bolArXiv, bolChrCd] both = 1 to ensure [z_Archive, character encoding]
	povrL_pStrP_replace  0  1  "$povrL"  "$pStrPL"
}

# test - see 'fileops run.sh' for Howells reviews


#  dOvrL_pStrP_replace_run_bag()			#() collection of old runs
# 23Apr2025 initial

	dOvrL_pStrP_replace_run_bag()  
{
	echo ''

	d_Flat="$d_Qndfs"'symsFlatLiner/'
	p_OvrL="$d_webWork"'dirWork/250423 symsFlatLiner pOvrL.txt'
	pStrPL="$d_webWork"'dirWork/250423 symsFlatLiner pStrP.txt'
	find "$d_Flat"  -maxdepth 2 -type f  \( -name "*.ndf" -o -name "*.txt" \)  |  grep  --invert-match  "z_Old\|z_Archive"  |  sort -u  >"$p_OvrL" 
	povrL_pStrP_replace  1  1  "$p_OvrL"  "$pStrPL"  


}


#] dOvrL_pStrP_replace_run				#(bolArXiv bolChrCd dOvrL pStrP) sed replace encoded pStrP in dOvrL
#]    normally set [bolArXiv, bolChrCd] both = 1 to ensure [z_Archive, character encoding]
#]    WARNING! all pStrP cannot have \t other than to separate!
# 23Apr2025 initial based on povrL_pStrP_replace_run()  
# dOvrL means files withing are changed, not dirs
# manually create dated z_Archive dirs for each subDir BEFORE using this function! (safety first)

	dOvrL_pStrP_replace_run()  
{
	d_Flat="$d_Qndfs"'symsFlatLiner/'
	p_OvrL="$d_webWork"'dirWork/250423 symsFlatLiner pOvrL.txt'
	pStrPL="$d_webWork"'dirWork/250423 symsFlatLiner pStrP.txt'

	find "$d_Flat"  -maxdepth 2 -type f  \( -name "*.ndf" -o -name "*.txt" \)  |  grep  --invert-match  "z_Old\|z_Archive"  |  sort -u  >"$p_OvrL" 

	povrL_pStrP_replace  1  1  "$p_OvrL"  "$pStrPL"  
}

# test 
#	pStrPL="$d_temp"'povrL_pStrP_replace_run pStrPL.txt'
#	echo  "ProjMini/Kaal- Structured Atom Model	ProjMajor/Electric Universe/Kaal SAM nucleus"  >"$pStrPL"


#] +-----+ 
#] lines - [extract, replace] * [line sequence, [func, optr] name]s]


#] pinn_rmBlankLines_povr_run					#(povr) removes [empty, with spaces] lines
# 16May2026 initial

	pinn_rmBlankLines_povr_run()
{
# 16May2026 test 
	pinn="$d_Refs"'mythology/KingJames/z_Archive/4 King James with titles small file archive.txt'
	povr="$d_temp"'povr_rm_emptyLines.txt'
	pinn_rmBlankLines_povr   "$pinn"  "$povr"
# >> OK
}


#] pinn_getSortU_pWordL_run							#() get sorted list of words in txt file
# 16May2026 initial - working well with few exceptions now
# see strings.sh for [sedChrProblem_to_return, sedApo_to_return, sedPunc_to_return]

	pinn_getSortU_pWordL_run()
{
# 16May2026 test <1 minute
#	pinn="$d_Refs"'mythology/KingJames/z_Archive/4 King James with titles small file archive.txt'
#	pWordL="$d_temp"'pinn_getSortU_pWordL.txt'
#	pinn_getSortU_pWordL  "$pinn"  "$pWordL"
# >> OK?

# 16May2026 full BibleKingJamesGutenberg <1 minute
	dWork="$d_Refs"'mythology/KingJames/'
	pinn="$dWork"'6 King James, project Gutenberg with Howell instructions.txt'
	pWordL="$dWork"'KingJames wordL.txt'
	pinn_getSortU_pWordL  "$pinn"  "$pWordL"
# >> OK, but misses \n for !#\t 
#		convert all [’“”] to ['""] in [original file, 6 King James, ... Howell instructions.txt]
#		joins words? [theEzrahite, ThenEzra, ThenJonah, ...]  - actually NOT in file!!! ??
#			might be hidden chrs

}




#] pinn_getLinseq_povr_run				#(pinn, povr) extract a sequence of lines between [strt, endd] markers
#]    default use of ["^#strt:","^#endd:"]=[strt, endd] markers in pTxt (don't use <> etc!!!)
#]    for now assumes only 1 [strt, endd]
# 12Oct2024 code disappeared or what?

#	pinn_getLinseq_povr_run()
#{  
#	
#
#
#
#}


#] pQndfCoreL_pOptrNamPL_replace_run		#() pre-setup of povrL_pStrPL_replace  
	pQndfCoreL_pOptrNamPL_replace_run()
{  
	echo ''  >/dev/null
	# for core list, see "$d_Qndfs"'QNial setup.ndf'
#	pQndfCoreL="$d_Qtest"'QNial pLCoreLib.txt'
	pQndfCoreL="$d_Qtest"'QNial pLSpecial.txt'  
	pOptrNamPL="$d_Qtest"'optrNam changes- types.txt'  

	pOptrNamOldL="$d_Qtest"'optrNamOld- types.txt'  
	poutOld="$d_Qtest$date_ymd"' optrNamOld- occurences in QndfCoreL.txt'  

	pOptrNamNewL="$d_Qtest"'optrNamNew- types.txt'  
	poutNew="$d_Qtest$date_ymd"' optrNamNew- occurences in QndfCoreL.txt'  

	sed  's|\t.*||'  "$pOptrNamPL"  >"$pOptrNamOldL"
	sed  's|.*\t||'  "$pOptrNamPL"  >"$pOptrNamNewL"
	
#	pinnL_pStrL_getPthsWithStrL_pout  "$pQndfCoreL"  "$pOptrNamOldL"  "$poutOld"  
#	pinnL_pStrL_getPthsWithStrL_pout  "$pQndfCoreL"  "$pOptrNamNewL"  "$poutNew"  
	povrL_pStrPL_replace  1  "$pQndfCoreL"  "$pOptrNamPL"  

}  



#]  +-----+
#]  Paragraph  - contiguous lines, with line breaks but no whitespace lines


#] pinn_uniteParagraphs_povr_run			#(no args) consolidate paragraphs in pinn
	pinn_uniteParagraphs_povr_run()
{
	d_work="$d_Refs"'mythology/'
	finn='King James, project Gutenberg separate clauses, no-returns in clause.txt'
	fout='King James, project Gutenberg separate clauses, no-returns in clause, paragraphs consolidate.txt'
	pinn_uniteParagraphs_povr  "$d_work$finn"  "$d_work$fout"
}

# $ bash  "$d_fileops"'fileops run.sh'  


#] transcript_unite_nLines_run				#(no args) keep timestamp each n lines of transcript
	transcript_unite_nLines_run()
{
	d_work="$d_projMaj"'History/Ukraine-Russia/'
	finn='250622 transcript rawTxt militarySummary: US Struck [Fordow, Isfahan, Natanz], RU broke Defense Near Pokrovsk.txt'
	fout='250622 transcript pargrf militarySummary: US Struck [Fordow, Isfahan, Natanz], RU broke Defense Near Pokrovsk.txt'
	transcript_unite_nLines  12  "$d_work$finn"  "$d_work$fout"
} 


#  transcript_unite_each_paragraph_bag		#(no args) old runs
	transcript_unite_each_paragraph_bag()
{  
	d_work="$d_web"'My sports & clubs/natural- Suspicious/'
	finn='230915 Bosnian Pyramids: 30,000-Year-Old, transcript.txt'
	fout='230915 Bosnian Pyramids: 30,000-Year-Old, paragraphs.txt'
	transcript_unite_each_paragraph  "$d_work$finn"  "$d_work$fout"

	d_work="$d_PROJECTS"'My Reviews/'
	finn='NCAA-D-25-00100R1 b anon AViAMS: Brain-inspired Audio-Visual Associative Memories using Spiking Neural Networks faw.txt'
	fout='NCAA-D-25-00100R1 b anon AViAMS: Brain-inspired Audio-Visual Associative Memories using Spiking Neural Networks para.txt'
	transcript_unite_each_paragraph  "$d_work$finn"  "$d_work$fout"

	d_work="$d_projMin"'Mythology/Hebrew/'
	finn='Ken Johnson 11Mar2024 Book of Enoch- Gods Original Prophetic Calendar, transcript.txt'
	fout='Ken Johnson 11Mar2024 Book of Enoch- Gods Original Prophetic Calendar, transcript 1min per paragraph.txt'
	transcript_unite_each_paragraph  "$d_work$finn"  "$d_work$fout"

}


#] transcript_unite_each_paragraph_run		#(no args) reformat [audio, video] transcripts (eg YouTube)
	transcript_unite_each_paragraph_run()
{
	d_work="$d_projMaj"'History/Ukraine-Russia/'
	finn='250622 transcript rawTxt militarySummary: US Struck [Fordow, Isfahan, Natanz], RU broke Defense Near Pokrovsk.txt'
	fout='250622 transcript pargrf militarySummary: US Struck [Fordow, Isfahan, Natanz], RU broke Defense Near Pokrovsk.txt'
	transcript_unite_each_paragraph  "$d_work$finn"  "$d_work$fout"
}



#] +-----+
#] notes files:


#] pNotes_str_get_dateBefore_StrLine_dateAfter_run		#() extract [dateBefore, str] lines

	pNotes_str_get_dateBefore_StrLine_dateAfter_run()
{
	dItems="$d_projMaj"'History/Ukraine-Russia/'
	fNotes='7_Military Summary battle notes.txt'
	#pNotes_str_get_dateBefore_StrLine_dateAfter	"$dItems"	"$fNotes"	'Myrnohrad'  
	#pNotes_str_get_dateBefore_StrLine_dateAfter	"$dItems"	"$fNotes"	'Orikhiv'  
	#pNotes_str_get_dateBefore_StrLine_dateAfter	"$dItems"	"$fNotes"	'Pokrovsk'  
	pNotes_str_get_dateBefore_StrLine_dateAfter	"$dItems"	"$fNotes"	'Kostyantynivka'  
}




#08********08
#] +-----+ 
#] '* run.sh' files - un-comment (rm '#] '] of function description, then
#]		$bash  "$d_fileops"'fileops run.sh'  

#] which are the "active lines" that will be run? doesn't work 100%
# $ grep  "^[ 	]*[A-Za-z0-9_]\+[ 	]\+.*#"  "$d_fileops"'fileops run.sh'
# note 	use of tab key in grep search expression
# func defs come BEFORE 'titleLine capture for TableOfContents: 
#		uncomment (delete '#]') of titleLine to run choice, BUT put back later!
# eliminate func defs: [ 	]\+.*#
# this is for simple run files, need more for other

# 22Nov2025 quick tests 

#	grep  "^[ 	]*[A-Za-z0-9_]\+[ 	]\+.*#"  "$d_fileops"'fileops run.sh'
#	grep  "^[ 	]*[A-Za-z0-9_]\+[ 	]\+.*#"  "$d_fileops"'strings run.sh'
#	grep  "^[ 	]*[A-Za-z0-9_]\+[ 	]\+.*#"  "$d_bin"'webLocal/0_test/webLocal library tests.sh'
#	grep  "^[ 	]*[A-Za-z0-9_]\+[ 	]\+.*#"  "$d_bin"'webLocal/webLocal [find, fix, create] normal details.sh'
#	grep  "^[ 	]*[A-Za-z0-9_]\+[ 	]\+.*#"  "$d_bin"'webLocal/webLocal run mass changes one-time.sh'
#	grep  "^[ 	]*[A-Za-z0-9_]\+[ 	]\+.*#"  "$d_bin"'webLocal/webLocal run step-by-step.sh'
#	grep  "^[ 	]*[A-Za-z0-9_]\+[ 	]\+.*#"  "$d_bin"'webLocal/0_test/webLocal library tests.sh'



#] +-----+
#] links to other funcs elsewhere 

#]    htmlHeadings_to_TblOfContents: see "$d_bin"'webLocal/webLocal [find, fix, create] normal details.sh'




# 24********08

# 07Feb2025 NO longer listed in _run: why?
#	pth_get_ext  "$d_fileops"'fileops run.sh' 
#	povrL_pRgxP_replace  1  "$d_Qroot"'240315 pNdfL for arrays nest
#	pinnL_str_extractCountPathsWithStrTo_pout_run
#	povrL_pRgxP_replace  1  "$d_Qroot"'240315 pNdfL for arrays nested.txt'  "$d_Qroot"'240315 pStrP for arrays nested.txt'
#	pinn_timeModTo_yymmddhms  "$d_SysMaint"'Linux/timestamps notes.txt'


#*******************************************************************************
#] +-----+
#] run - select one of options
# To build the "run" list below : 
#1. $ grep  "^#] "  "$d_fileops"'fileops run.sh' |  sed "s|^#] |\t# |" 
#2. copy terminal output
#3. paste below line # copy-past below :  
#			 before lines:
#					# $ bash  "$d_fileops"'fileops run.sh' 
#					# enddoc

#	+-----+
#	coding tools
#	test_output					 			#(standrd  result) 
#	code_get									#(no args) [symbol, function] codes: list all being used
#	   to check against new random codes
#	code_make								#(fractionSeed) new [symbol, function]s: generate [new, unique] code 
#	fNdfL_subDirRef_argOrderNum_dout_run	#() extract list of uses of each of pthOptrNamL 
#	fSrc_pStrUse_appendTo_pSrcChk_run	#() redistributes strUse from-str-to-Src basis  
#	dir_fextn_pthLExclud_findPthL_pout_run	#() find str in files with fextn in dir, results to pout
#	dirSrc_fbase_fxtn_str_appendTo_pStrUse_run	#() append list of uses of optrNam 
#	+-----+
#	[pth, dir] tools
#	pth_get_dir_run							#(pth) retrieve dir holding pth, dir must exist or error
#	pth_get_dArchive_run						#(pth) returns dArc for pth
#	pth_get_pArcDate_run						#(pth) of form "$dArc$fNoX archive.$fExt", creates dArc if required
#	pth_get_pArcArch_run	 					#(pth) returns pArc for pth, or 0 for error, assuming archive is dated
#	+-----+ 
#	archive [fil, dir]s
#	pinn_archiveLocal_run					#(pInn) normal backup of form "$dArc$fNam archive.$fext"
#	wrkSpcL_arcArch							#() easy backup of many workSpaces
#	pthL_fsizCompare_optr_process_run	#(pth fsizeCompare optr)optr pthL based on fSizes (bytes)
#	pinn_timeModTo_timeUnix_run 				#(tMod) for lftp uploads, mods only when file [change, update]d?? 
#	pSortedL_rename_as_intL_run			#() required by ffmpeg to produce video from pImages @ same format
#	pMain_strPthStrt_put_pOut_run			#(strPthStrt, pMain, pOut)  replace line strPthStrt with pOut 
#	   strPth must not use ANY "sed delimiters", eg strPth "#|pth " will ruin 's|||'
#	pinnL_pSedExpL_get_povr_run_bag		#(dWork pinnL povr p_log) find sedExpr quotes in pinnL 
#	+-----+ 
#	pinnL mv (rename) according to [fNameOld, fNameNew, 
#	pinnL_pSedExpL_get_povr_run			#(dWork pinnL povr p_log) find sedExpr quotes in pinnL 
#	pinn_pOld_pNew_replace_run				#() test code only, don't use normally!   ??? where is ndf?
#	pinnL_pOldNewPL_replace_run			#()   ??? where is ndf?
#	+-----+ 
#	[extract, replace] strings in pinnL
	#pinn_pStrL_grep_dout  "$d_Refs"'mythology/King James, project Gutenberg.txt'  "$d_projMin"'Mythology/Bible/grep seven/0_pStrL.txt'  "$d_projMin"'Mythology/Bible/grep seven/'		# res ipsa loquitor
	#	grep  --invert-match  "^7:[0-9]\+ \|[0-9]\+:7 "  "$d_projMin"'Mythology/Bible/grep seven/7.txt'  >"$d_projMin"'Mythology/Bible/grep seven/7 no-clause.txt'		# res ipsa loquitor
#	pinnL_str_extractPthLWithStr_pout_run	#() grep 'st' --with-file-name, lineNum
#	pinnL_pStrL_getPthsWithOUTstrL_pout_run		#() paths of pinnL withOUT str
#	pinnL_str_extractCountPathsWithStrTo_pout_run	#() txtLines with str of pinnL
#	povrL_pStrP_replace_run					#(bolArXiv bolChrCd povrL pStrP) sed replace encoded (pStrP, povrL)
#	dOvrL_pStrP_replace_run				#(bolArXiv bolChrCd dOvrL pStrP) sed replace encoded pStrP in dOvrL
#	   normally set [bolArXiv, bolChrCd] both = 1 to ensure [z_Archive, character encoding]
#	   WARNING! all pStrP cannot have \t other than to separate!
#	+-----+ 
#	lines - [extract, replace] * [line sequence, [func, optr] name]s]
#	pinn_rmBlankLines_povr_run					#(povr) removes [empty, with spaces] lines
	pinn_getSortU_pWordL_run							#() get sorted list of words in txt file
#	pinn_getLinseq_povr_run				#(pinn, povr) extract a sequence of lines between [strt, endd] markers
#	   default use of ["^#strt:","^#endd:"]=[strt, endd] markers in pTxt (don't use <> etc!!!)
#	   for now assumes only 1 [strt, endd]
#	pQndfCoreL_pOptrNamPL_replace_run		#() pre-setup of povrL_pStrPL_replace  
#	pinn_uniteParagraphs_povr_run				#(no args) consolidate paragraphs in pinn
#	transcript_unite_nLines_run				#(no args) keep timestamp each n lines of transcript
#	transcript_unite_each_paragraph_run		#(no args) reformat [audio, video] transcripts (eg YouTube)
#	+-----+
#	notes files- mostly see 'UR-RU notes dated str grep.sh' in fileops dir :
#	pNotes_str_get_dateBefore_StrLine_dateAfter_run		#() extract [dateBefore, str] lines
#	pNotes_divider_get_pKeyWrdLL				#() extract sections of notes, save each to one of pSectionLL
#	+-----+ 

#	
#	*********************
#	run - uncomment to select one of options above




# $ bash  "$d_fileops"'fileops run.sh'  

# enddoc
