Sorting solaris中如何基于count列grep唯一重复记录

Sorting solaris中如何基于count列grep唯一重复记录,sorting,grep,uniq,solaris-10,Sorting,Grep,Uniq,Solaris 10,我想grep记录异常,并用它们的计数标识unique 以下是示例输入 [msisdn:123][trxId:1234] | subscriptions | java.lang.Exception: this msidn NOT found [msisdn:432][trxId:1212] | subscriptions | java.lang.Exception: this msidn NOT found [msisdn:232][trxId:3232] | subscriptions | ja

我想
grep
记录异常,并用它们的计数标识unique

以下是示例输入

[msisdn:123][trxId:1234] | subscriptions | java.lang.Exception: this msidn NOT found
[msisdn:432][trxId:1212] | subscriptions | java.lang.Exception: this msidn NOT found
[msisdn:232][trxId:3232] | subscriptions | java.lang.Exception: this msidn NOT found
我使用了下面的方法,它显示了重复计数

grep -i exception my.log| cut -d'|' -f2- | uniq –c
它显示了预期的结果,但我松开了包含msisdn和trxid的第一部分,然后我使用了下面的内容

grep -i exception my.log | sort -u  -k 2,3 -t'|' 
它显示了样本行的独特结果,并且基于包含msisdn和trxid的样本行,我可以进行故障排除

现在,如何使用上次使用的命令获取计数?

这应该可以:

grep -i exception my.log | sort -k 2,3 -t'|' | uniq -c -f 1
输出:

      3 [msisdn:123][trxId:1234] | subscriptions | java.lang.Exception: this msidn NOT found

编辑您的问题以显示预期的输出给定该示例输入,我不知道您是否试图查找每msisdn或每trxid或每两者的组合的计数或其他内容。无论它是什么,只要一个小的、清晰的awk脚本,它都是绝对微不足道的。