This is a long process and my script takes close to 10 minutes to complete. What I want to know is that whether this can be optimized or not ? Is is possible to run one grep command and find out the number of time StringA, StringB and StringC has been called individually ?
This much I understand, you do not want to read the log file three times and that's what you got so far.
Are you tallying the result as StringA_count + StringB_count + StringC ?
If StringA and StringB or any combination is in the same line, does it count as two, three, one or none?
By the way, grep doesn't need wc -l to tell the count grep -c will do
StringA and StringB and StringC counts as none
StringA and StringB counts as two times
StringB and StringA counts as two times
StringA alone counts as one time
StringB and StringC counts as none
StringB alone counts as one time
StringC alone counts as one time
StringC and StringB counts as none
variable total equals seven. Is this correct?
If not, please, post a representative portion of your log file and current script.