Thank you for your reply. To just have one 'State' for the CallId , I created one new logfile as the following:
#more logfile1 | grep "State TK" >> logfile2 Then in the logfile2 , I tried to count the number of occurances of each distinct CallId with the aid of your proposed command . But in the output, I see differences between the number obtained from counting them manually with the one generated from your command. Can you please correct me?