##########################
#
# Script to read a text file and count the occurrences of a full stop.
#
#
#
##########################
for z in SED
do
A=0
B=0
C=0
while read -r a
do
# echo ${a}
if [[ ${a} == *.* ]]
then
# echo "True"
A=`expr ${A} + 1`
echo ${a} | sed 's/\./\.\n/g' | sed 's/^ //g'
B=`echo ${a} | tr -d -C "." | wc -c`
C=`expr ${B} + ${C}`
echo -e "Current count of full stops: "${B}
echo -e "Running count of full stops: "${C}
else
echo -e "\t\t--> This line does not contain a full stop"
fi
done</tmp/sed1 ## Text file here!!
# echo -e "Total count: ${A}"
echo -e "Total count of full stops: ${C}\n\n"
done
No comments:
Post a Comment