read files from a folder and grep a string
I have a folder and there some random files are created after my product run. The files names are different but extn is .xml. and i have to grep a particular string from all the files and get the total count. like in that folder the files are q12qw.xml,w23ws.xml,s24de.xml ... and from these files i have to count the name "<CX900BT>". So in my script it reads the file but cannot grep the string.
# read files from a folder and grep a string
for i in "$LIST"; do
count1=$(grep -c '<CX900BT>' $i)
The output comes as
0+q12qw.xml:1 w23ws.xml:9 s24de.xml:1
But i want like it come
0+1+9+1=11 or total=11
Could any one help me.