#!/bin/sh
#] 
#] *********************
#] $ bash "$d_bin""symbols classify manual.sh"  - manually classify symbols in "symDiff bads [HFLN,Lucas].txt"
# www.BillHowell.ca  15Jul2018 initial
# # called with one of "[HFLN,Lucas]"

# to run  $ bash "/media/bill/SWAPPER/Qnial/MY_NDFS/symbols classify manual.sh" "[HFLN,Lucas]"

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

d_Luca="/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/RaspPi_ext4_32Gb/temp/"
else
   echo "symbols grep-sed.sh Error: [PROJECTS or SWAPPER] USB memory stick not mounted"
fi

f_innn="$d_temp""symDiff bads $1.txt"
f_temp="$d_temp""classed tranSym $1 temp.txt"
f_tran="$d_temp""classed tranSym $1.txt"
f_tem2="$d_temp""classed tranExpr $1 temp2.txt"
f_tra2="$d_temp""classed tranExpr $1.txt"
f_good="$d_temp""classed good $1.txt"
f_engl="$d_temp""classed english $1.txt"
f_eqtn="$d_temp""classed equation numbers $1.txt"
f_latr="$d_temp""classed later $1.txt"
f_ignr="$d_temp""classed ignore $1.txt"


# see "/media/bill/SWAPPER/System_maintenance/Linux/file read loops.txt"


#] rm_temps()  - 

	rm_temps()
{  
rm "$f_temp"
rm "$f_tran"
rm "$f_good"
rm "$f_engl"
rm "$f_eqtn"
rm "$f_latr"
rm "$f_ignr"
}  


#] sort_manual_symbols()  - 

	sort_manual_symbols()
{  
# 26Jul2018 rm_temps can be commented out, so as to pick-up where "symbols classify manual.sh" was only partly done
# (eg - Ctl-C accidentally for terminal copy)
rm_temps
let "i = 0"

while read -u 9  line; do
	let "i = $i + 1"
	echo "$i   $line"
	read -p  "[(t)ranList,tranE(x)pression,(g)ood,(e)nglish,equatio(n),(l)ater,(i)gnore] :  " inn 
	if   [ "$inn" = t ];then	echo >>"$f_temp"  "\t""$line""\t\t\t\t\t\t\t""$line""\t\t\t\t\t\t\t""added $dater"
	elif [ "$inn" = x ];then	echo >>"$f_tem2"  "\t""$line""\t\t\t\t\t\t\t""$line""\t\t\t\t\t\t\t""added $dater"
	elif [ "$inn" = g ];then	echo >>"$f_good"  "$line"
	elif [ "$inn" = e ];then	echo >>"$f_engl"  "$line"
	elif [ "$inn" = n ];then	echo >>"$f_eqtn"  "$line"
	elif [ "$inn" = l ];then	echo >>"$f_latr"  "$line"
	elif [ "$inn" = i ];then	echo >>"$f_ignr"  "$line"
	else echo "Oops : error for $line"
	fi
done 9<"$f_innn"  

# 21Jul2018  is to get around my inability to put real tabs in above : 
# 26Jul2018 - just copy trans symbols to "$f_tran", as some re-thinking will be usual!!
#"\t""$line""\t\t\t\t\t\t\t""$line""\t\t\t\t\t\t\t""added $dater"
cat  "$f_temp"  |  sed 's/\(\\t\\t\\t\\t\\t\\t\\t\)/"\t\t\t\t\t\t\t"/g'  |  sed 's/\(\\t\)/\t"/g'  |  sed 's/$/"/g'  |  tr  \"  \'   >>"$f_tran"
cat  "$f_tem2"  |  sed 's/\(\\t\\t\\t\\t\\t\\t\\t\)/"\t\t\t\t\t\t\t"/g'  |  sed 's/\(\\t\)/\t"/g'  |  sed 's/$/"/g'  |  tr  \"  \'   >>"$f_tra2"
}  


sort_manual_symbols 



# enddoc
