Use less wc calls

Use grep -c to avoid a call to wc