[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#72617: sort -n loses lines.
From: |
Pádraig Brady |
Subject: |
bug#72617: sort -n loses lines. |
Date: |
Wed, 14 Aug 2024 10:48:53 +0100 |
User-agent: |
Mozilla Thunderbird Beta |
tag 72617 notabug
close 72617
stop
On 14/08/2024 09:43, Simon B wrote:
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
Adding the --debug option shows the issue.
I.e. the '.' being considered as part of a number:
$ sort --debug -rbn -s ips
sort: text ordering performed using ‘en_IE.UTF-8’ sorting rules
sort: note numbers use ‘.’ as a decimal point in this locale
178.128.44.128
_______
172.169.6.164
_______
172.169.5.249
_______
Taking the example for sorting IPv4 addresses from the manual,
shows the desired comparisons being performed:
$ sort --debug -t '.' -k 1,1rn -k 2,2rn -k 3,3rn -k 4,4rn -u ips
sort: text ordering performed using ‘en_IE.UTF-8’ sorting rules
sort: numbers use ‘.’ as a decimal point in this locale
178.128.44.128
___
___
__
___
172.169.6.164
___
___
_
___
172.169.5.249
___
___
_
___
cheers,
Pádraig