i have array values as below and used in below for loop.
a=(400 402 403 404)
for i in "${a[@]}"
do
echo $i;
done
output
400
402
403
404
I need to take array values one by one and use as below.
for i in "${a[@]}"
do
awk '{if($8==$i) print} filename.log | wc -l;
done
i need find the errors count in httpderror.log so i am passing http error codes one by one to check file and print count of error found in each http code. Http error found in 8th column ($8==$i).
output should be error count of matched lines like 400 - 44, 402 -43 but need only values as below..
44
43
42
Please help me how to do this....