How to grep multiple string occurance in input file using single grep command? I have below input file with many IDP, RRBE messages. Out put should have count of each messages.
I have used below command but it is not working
grep -cH "(sent IDP Request)(Recv RRBCSM)" *.txt >>Sigtran_Errorlogs.txt
This method will be effective is i have only 1 input file but I have many input log files. If you send same command using grep for multiple files it will be more useful
You can do this or that, but you cannot do the both.
grep -cH "\(sent IDP Request\)\|\(Recv RRBCSM\)"
This will show the count of both matches.
But if you want it in a different count, you have to use more than one grep, i dont believe anyother way is exists with single grep ?
Why do you want it to be achieved in single grep ?!
I was just seaching for similar commond like below which I used for greping numbers. Since here matched string line is not uniq it is not printing total count for matched string in given input file.