How to see high values on top

Hello folks,

I am searching for pattern, after that i want its presenece on top to bottom basis, like

cat abcd.txt |grep "123"|awk {'print $3'} |sort|uniq -c

it show result like

10 1.1.1.1
1 1.1.1.1
15 1.1.1.1
100 1.1.1.1

but i want to see this like

100 1.1.1.1
15 1.1.1.44
10 1.1.33.1
1 1.1.1.232

high presence on top, low presence on bottom

cat abcd.txt |grep "123"|awk {'print $3'} |sort|uniq -c |sort -nr
sort -nr

Btw. it looks like a useless use of cat :smiley:

In fact, there are more useless pipes and commands. I just simply add one more command to make the job done.

Here is the one command solution :cool:

awk '/123/ {a[$3]++}  END {for (i in a) print a,i |"sort -nr"}' urfile