Production problems, check the nginx log, found some request access back to 200, some access to return 502, now want to which target IP will return 502 statistics, the distribution of the request, so that the fault location, will want to ask you how to do, the more simple the more rapid, the better,
This is the case:
$cat 1. TXT
200 21.102.22.88
200 21.102.22.88
502 21.102.22.88
200 21.102.22.78
200 21.102.22.78
502 21.102.22.88
200 21.102.22.68
502 21.102.22.88
I offer my way, I like to use perl:
$cat 1. TXT | perl - MData: : Dumper - anE '$h - & gt; [1]} {$F - & gt; [0]} {$F + +; } {say Dumper $h '
$VAR1={
'21.102.22.68=& gt; {
'200'=& gt; 1
},
'21.102.22.88=& gt; {
'200'=& gt; 2,
'502'=& gt; 3
},
'21.102.22.78=& gt; {
'200'=& gt; 2
}
};