Take 10 latest line data

Good day for us.
I want to ask what is the manner to count total of spesific character or string in 10 latest line. I mean from Latestline - 10 line until Latest line.
Example :
If the latest line of my file is 455th line, I just want to count total of spesific string from line 446th to 455th.

I have file that contains of character.

LatestTest.log

1=1
2=0
1=0
4=0
4=1
4=1
3=0
4=1
2=0
1=1
1=0
1=0
2=1
2=1

Total of line my LatestTest.log frequently changed (added) and I just want to take 10 latest data line.

for Example:
I want to take total of string (2=1) in 10 latest line.

Thank you..

Your request is a little vague...

To get the number of the last ten lines of the file LatestTest.log that have entire lines that exactly match the string 2=1 , try:

tail LatestTest.log|grep -Fcx '2=1'

To get the number of the last ten lines of the file LatestTest.log that contain the string 2= , try:

tail LatestTest.log|grep -Fc '2='

To get the number of times the string 2 appears in the last ten lines of the file LatestTest.log , try:

tail LatestTest.log|awk '{c+=gsub("2", "")}END{print c}'

If you want to process the last number lines of a file instead of the last ten lines, change tail filename to tail -n number filename .

Thank you Mr Cragun..
Your code works well.

Hallo all,
Im sorry if I come again to this thread.
I want to ask how is the manner if I want to count spesific character from certain line to certain line.
For example in case :
This is my file looks like.

SpaceState.log

1
1
1
1
1
1
0
0
1
1
1
1
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
1
1

Actually my file contain of thousands line.
How to count for "1" character from 10th line to 20th line.
Thanks..

Try

awk 'NR==10,NR==20 {CNT[$1]++} NR==20 {exit} END {print CNT[1]}' file
8

Try:

awk 'NR<10{next} $1==1{c++} NR==20{print c; exit}' file

--
or

tail +10 file | head -10 | grep -Fcx 1

--
or

awk 'NR<b{next} $1==n{c++} NR==e{print c; exit}' b=10 e=20 n=1  file

--
note: the second option will not work correctly if lines may contain spaces or tabs..
--
On Solaris use /usr/xpg4/bin/awk , /usr/xpg4/bin/grep , /usr/xpg4/bin/tail