[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#72617: sort -n loses lines.
From: |
Simon B |
Subject: |
bug#72617: sort -n loses lines. |
Date: |
Wed, 14 Aug 2024 10:43:06 +0200 |
Hallo,
The output of my grep command is:
# grep -i "sshd" /root/access.report | egrep -o
'(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-
9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)'
64.227.127.122
172.169.5.249
172.169.6.164
172.168.40.186
13.64.194.111
71.6.134.231
178.128.44.128
178.128.44.128
178.128.44.128
178.128.44.128
178.128.44.128
178.128.44.128
178.128.44.128
178.128.44.128
178.128.44.128
178.128.44.128
71.6.134.231
45.56.94.150
45.155.91.30
35.86.214.67
35.84.0.64
142.93.95.82
142.93.95.82
142.93.95.82
142.93.95.82
142.93.95.82
142.93.95.82
142.93.95.82
142.93.95.82
142.93.95.82
142.93.95.82
142.93.95.82
142.93.95.82
142.93.95.82
142.93.95.82
35.94.106.188
115.231.78.8
34.223.41.242
35.84.141.160
159.65.29.253
115.231.78.8
The expected return of sort (sort -urbn) is:
178.128.44.128
172.169.6.164
172.169.5.249
172.168.40.186
159.65.29.253
142.93.95.82
115.231.78.8
71.6.134.231
64.227.127.122
45.56.94.150
45.155.91.30
35.94.106.188
35.86.214.67
35.84.141.160
35.84.0.64
34.223.41.242
13.64.194.111
The actual return of sort is:
# grep -i "sshd" /root/access.report egrep -o
'(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)'
| sort -urbn
178.128.44.128
172.169.5.249
172.168.40.186
159.65.29.253
142.93.95.82
115.231.78.8
71.6.134.231
64.227.127.122
45.56.94.150
45.155.91.30
35.94.106.188
35.86.214.67
35.84.0.64
34.223.41.242
13.64.194.111
The expected return is only achieved by calling sort twice.
egrep -o
'(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)'
| sort -urb | sort -nr
178.128.44.128
172.169.6.164
172.169.5.249
172.168.40.186
159.65.29.253
142.93.95.82
115.231.78.8
71.6.134.231
64.227.127.122
45.56.94.150
45.155.91.30
35.94.106.188
35.86.214.67
35.84.141.160
35.84.0.64
34.223.41.242
13.64.194.111
Regards
Simon
- bug#72617: sort -n loses lines.,
Simon B <=