in reply to
Re: Searching pattern in 400 files and getting count out of each file
in thread Searching pattern in 400 files and getting count out of each file
The original posting also (through the grep) reads each file for every pattern. i.e. it opens every single file (400 of them) 8000 or so times. Look at strategies to just read each file once; another reply on this thread seems to have implicitly done this, without clarifying why, and it also misses the opportunity to tidy up the patterns outside the file read loop.
A Monk aims to give answers to those who have none, and to learn from those who know more.