cut sort uniq

on

One of my scripts echo’s a lot of logging to a logfile. Now I want to analyse this file. One of the analyses is simply counting all logtypes. The logtype is written as first characters in the format **[TYPE]**. A quick analysis can be written as:

knilluz@server:~/BCS-test$ cut -d* -f3 altmsg.log | sort | uniq -c | sort -n
      1 LOG
     98 ALTERED
    131 NOTHING
    229 NEWFILE
    316 MSG_FOUND
    762 FROM
    762 TO
   8065 NOT

The field separator (-d) is *, find the third field  **ALTERED**. sort the output, unify them and count the lines (-c) sort this list and handle the sort fiels as numbers (-n).