Use grep -c to count the number of matching lines
Reference: http://blog.csdn.net/xuejiayue1105/article/details/1483940