GNU bug report logs -
#72617
sort -n loses lines.
Previous Next
Reported by: Simon B <simon.buongiorno <at> gmail.com>
Date: Wed, 14 Aug 2024 09:14:01 UTC
Severity: normal
Tags: notabug
Done: Pádraig Brady <P <at> draigBrady.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
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
[Message part 2 (text/html, inline)]
This bug report was last modified 279 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.