$ cat hadi | sort | uniq -c -w 9 | sort -n | perl -ne 'print unless
/(\d+)/ and $1 < 3' 4 CallId 91 State TK Bts 5 Bt 1 Tr (4 0x0f) E1 (4 0 18) Tru (0 1 1) 7 CallId 92 State CL Bts 7 Bt 1 Tr (6 0x0a) E1 (3 1
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?