#!/bin/sh
#] 
#] *********************
#] $ bash "$d_bin""symbols compliance special.sh"  - corrects "special errors" in f_derivatives
#]      DON'T use for normal symbol replacement!!
# www.BillHowell.ca  20Jul2018 re-create as lost original from 15Jul2018


# to run  $ bash "/media/bill/SWAPPER/Qnial/MY_NDFS/symbols compliance special.sh"

dater=$(date +"%y%m%d %kh%Mm")

d_Lucas="/media/bill/SWAPPER/Lucas - Universal Force/"

if   [ -d  "/media/bill/ramdisk/" ]; then
   d_temp="/media/bill/ramdisk/"
elif [ -d  "/media/bill/RaspPi_ext4_32Gb/temp/" ]; then
   d_temp="/media/bill/SWAPPER/Lucas - Universal Force/"
else
   echo "symbols compliance special.sh Error: [PROJECTS or SWAPPER] USB memory stick not mounted"
fi


finn="$d_temp""Howell - Background math for Lucas Universal Force, Chapter 4.txt"
fout="$d_temp""Howell - Background temp.txt"


#] grep_title()  - 

	grep_title()
{  
echo ""
echo "+--+"
echo "grep_symbol() : $1"
grep  "$1"  "$finn"
}  


#] grep_check()  - 

	grep_check()
{  
grep_title  'cos(Aθoc(POIo)[^)]'
grep_title  'cos(Aθoc(POIo)))]'
grep_title  'sin(Aθoc(POIo)[^)]'
grep_title  'sin(Aθoc(POIo)))]'
}  


#] sed_it()  - 

	sed_it()
{  
cat "$finn"  |  sed 's/cos(Aθoc(POIo)\([^)]\)/cos(Aθoc(POIo))\1/g'  \
             |  sed 's/sin(Aθoc(POIo)\([^)]\)/sin(Aθoc(POIo))\1/g'  \
             >"$fout"
}  


#] grep_sed_it()  - 

	grep_sed_it()
{  
echo ""
echo "+----------+"
echo "symbols compliance special.sh  $dater"
f_er="$finn" 


while read -r line; do
 	grep  -cF  "$line"  "$finn"  >>"$fot1"
done < "$finn" 


grep_check
sed_it
echo ""
echo "+----------+"
echo "grep_check() end"
f_er="$fout" 
grep_check  
# comment out for tests
cp  "$fout"   "$finn"
}  


grep_sed_it


#*************************

#] grep_check_sed_it_old()  - 

	grep_check_sed_it_old()
{  
#15Jul2018
grep  'cos(Aθoc(POIo)[^)]'  "$1"
grep  'cos(Aθoc(POIo)))]'   "$1"
grep  'sin(Aθoc(POIo)[^)]'  "$1"
grep  'sin(Aθoc(POIo)))]'   "$1"
cat "$finn"  |  sed 's/cos(Aθoc(POIo)\([^)]\)/cos(Aθoc(POIo))\1/g'  \
             |  sed 's/sin(Aθoc(POIo)\([^)]\)/sin(Aθoc(POIo))\1/g'  \
             >"$fout"
#17Jul2018 - using "Howell - Background math for Lucas Universal Force, Chapter 4 180713 13h11m58s.txt"



}  











# enddoc
