[CentOS] Text file manipulation in CentOS?

Tue May 11 11:46:47 UTC 2010
Eduardo Grosclaude <eduardo.grosclaude at gmail.com>

On Tue, May 11, 2010 at 8:12 AM, hadi motamedi <motamedi24 at gmail.com> wrote:
>
>
>> Does this help?
>> The first number is the number of occurrences of each CallId
>
> Thank you for your help. It is very important for me to how the number of
> occurances of each CallId# . But can you please let me know why the number
> obtained from your code does not match with manual counting on say one of
> the CallId#? Can you please correct me?

Oh, that's because uniq thinks that two lines are different if your
characters TK,CL... and the rest of the line are different. If you
want to count lines only by the number following CallId you should
tell uniq to compare only the first characters in the line:

$ 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
22)  Tru (0 0 0)
      7 CallId 94  State TK         Bts 7  Bt 1  Tr (6 0x0f)  E1 (7 0
15)  Tru (0 0 2)
      7 CallId  9  State TK         Bts 7  Bt 2  Tr (13 0x09)  E1 (4 1
5)  Tru (0 3 0)

(note -w 9).

-- 
Eduardo Grosclaude
Universidad Nacional del Comahue
Neuquen, Argentina