From unknown Thu Jun 19 16:11:26 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#72617 <72617@debbugs.gnu.org> To: bug#72617 <72617@debbugs.gnu.org> Subject: Status: sort -n loses lines. Reply-To: bug#72617 <72617@debbugs.gnu.org> Date: Thu, 19 Jun 2025 23:11:26 +0000 retitle 72617 sort -n loses lines. reassign 72617 coreutils submitter 72617 Simon B severity 72617 normal tag 72617 notabug thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 14 05:13:52 2024 Received: (at submit) by debbugs.gnu.org; 14 Aug 2024 09:13:52 +0000 Received: from localhost ([127.0.0.1]:46119 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1seA4l-0005iH-BP for submit@debbugs.gnu.org; Wed, 14 Aug 2024 05:13:52 -0400 Received: from lists.gnu.org ([209.51.188.17]:53644) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1se9bs-0004yc-CW for submit@debbugs.gnu.org; Wed, 14 Aug 2024 04:44:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1se9bJ-0006fV-Ep for bug-coreutils@gnu.org; Wed, 14 Aug 2024 04:43:25 -0400 Received: from mail-yw1-x112d.google.com ([2607:f8b0:4864:20::112d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1se9bG-0005wU-Je for bug-coreutils@gnu.org; Wed, 14 Aug 2024 04:43:25 -0400 Received: by mail-yw1-x112d.google.com with SMTP id 00721157ae682-68d30057ae9so62581707b3.1 for ; Wed, 14 Aug 2024 01:43:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723624998; x=1724229798; darn=gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=U7HMrC0gcmIuwV2eEYeABt0umS1CSqQOqAox3D2yE3w=; b=cZgdenDAZbD6KeYUR5hO8ZB4kxmnIzYJqlEOamTvXwnb7Zkd8/VZN7IFUPgZPPyTQx 51WwbcvhwUl4x01qLJRO9ELZNxq960QHPc8T4NRlhnr1Ttl03qu1hssB2DkCCescWYdv TBOSFPAvbWEPKnU1jDEkiR6SqNEMtfoK3BL8wV56vdSb8UaH90sh08lp/g9GYiANBjdM ZLD/JE1Viqhp0BtveB3rvUZT83kpWQA1c0SNBXauEWFWbTgtEjATJgLKaw6LzVAeXuie ed8XmQB0A2og4+pwY/bxbGRAK3aWuQJ7CoSwu+4862JUt/3hmrFYOrhIny6LJEnZNA+3 KS3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723624998; x=1724229798; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=U7HMrC0gcmIuwV2eEYeABt0umS1CSqQOqAox3D2yE3w=; b=ZqN/l1E858VnGh0nRQ0FwvaFvTO9B7L9xBRLFNGziGnRZmPDKw2MmR40sw/zgUVkQk eos6toIYutEqpDQRjkdhDb2lKXDQOT205coOQ0OD34z3mQd7m0dVYmviNGSjchiiAmSX ap53zNGv85ZwkBBUWzskMB+IpyyJTdolZG6wXR07Gixk34uc0GwnQcjj1Cns9h02g7hM rSulBIkajsO8ClxCDyZVhahlz5Iuj0F20fbOALYx37Be6cc41lfMfFmrUXOU2oREkkN6 jumk1pSzZwa4m6Mq2i+Kwhuo0ZEepABhrXohyL6rhBU4rpbOP2YqkcXv3wQ6DdhMJMJg KbsQ== X-Gm-Message-State: AOJu0Yw0/3dYUPjsgB485oq79NYNVSBsQZcS4xTjyITV4Tn3cDDwAquw tLQzWIg+ZBHQMPdwS9RwisUcJsYwYw9iIK8rdJz3S4fucMYWXI9atzopyyZQdJweBhRidONvBxA CxJdXjjZARtd01ArB5OdCyeeqQOUwKgZi X-Google-Smtp-Source: AGHT+IEQA/f2rqa6c/UGQS3gmHXiuKOrnrS20Zfwc96tb+9Pe+hhYbaWukpMTx2QqhVKwKcomo7TaaIF/hSi69H0SDs= X-Received: by 2002:a05:690c:700f:b0:627:ddef:34ab with SMTP id 00721157ae682-6ac97923a71mr24430157b3.24.1723624998029; Wed, 14 Aug 2024 01:43:18 -0700 (PDT) MIME-Version: 1.0 From: Simon B Date: Wed, 14 Aug 2024 10:43:06 +0200 Message-ID: Subject: sort -n loses lines. To: bug-coreutils@gnu.org Content-Type: multipart/alternative; boundary="000000000000bbd25c061fa0b794" Received-SPF: pass client-ip=2607:f8b0:4864:20::112d; envelope-from=simon.buongiorno@gmail.com; helo=mail-yw1-x112d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Wed, 14 Aug 2024 05:13:50 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --000000000000bbd25c061fa0b794 Content-Type: text/plain; charset="UTF-8" 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 --000000000000bbd25c061fa0b794 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hallo,

The output of my grep command is:

<= /div>
# grep -i "sshd" /root/access.report | egrep -o =C2=A0'(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.1= 68.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.12= 8
178.128.44.128
178.128.44.128
178.128.44.128
178.128.44.12871.6.134.231
45.56.94.150
45.155.91.30
35.86.214.67
35.84.0.6= 4
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
1= 42.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 sor= t (sort -urbn) is:

178.128.44.128
172.169.6.164
172.169.5.249<= br>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<= br>35.86.214.67
35.84.141.160
35.84.0.64
34.223.41.242
13.64.19= 4.111


The actual return of sort is:

# grep -i= "sshd" /root/access.report=C2=A0 egrep -o =C2=A0'(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]?)= 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 =C2=A0
34.223.41.242
13.64.194.111

The expect= ed return is only achieved by calling sort twice.

=C2=A0egrep = -o=20 =C2=A0'(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.24= 9
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.18= 8
35.86.214.67
35.84.141.160
35.84.0.64
34.223.41.242
13.64.= 194.111


Regards

Simon
--000000000000bbd25c061fa0b794-- From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 14 05:50:38 2024 Received: (at 72617) by debbugs.gnu.org; 14 Aug 2024 09:50:38 +0000 Received: from localhost ([127.0.0.1]:46139 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1seAeM-0006ac-0a for submit@debbugs.gnu.org; Wed, 14 Aug 2024 05:50:38 -0400 Received: from mail-wm1-f54.google.com ([209.85.128.54]:55696) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1seAeJ-0006aI-VO; Wed, 14 Aug 2024 05:50:36 -0400 Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-42817bee9e8so47333525e9.3; Wed, 14 Aug 2024 02:50:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723628935; x=1724233735; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=Dwuf318rr2lCZp+c4FVDEBix2Ef9AllwacpBRjTe1zQ=; b=Vy7iBI3sbJhLlnkTyDDz4/NRQ75hBXMuyBWjty0Hx7d1wEagbMcGilxWbQti3ngdYS na0ucgEZL1X8UlMDgQp+jDr8K3SxYL2C2MF3Aydq5QGGLFBisxBjyDFzh9B+YxzvmqmK JFSkboKqqxtsuaKtkdnbiKmxPQ2eGqSJ5HA4r++Wf8mjkFl04JFrJTZxlHuSb/nYm494 Dx7qsTJ58OYrDwEcaF5xCHI+4SzEpEjeXKk7lZE9WrpXn6TMoppnzYKamp4miLYNmvXg 69flV4ybmm3nDaCWtkNsa7wTCP6x6bz8P15OOMtAYxboQ2GJVqSnGPlxaE+DrrjBTt+v Sx1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723628935; x=1724233735; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Dwuf318rr2lCZp+c4FVDEBix2Ef9AllwacpBRjTe1zQ=; b=P33G/lpjfGXaqMa667czdCo5pqdk5c06hLIsI8kKLwK5r5zkMH45OxXuc+qrrHTqhD UoB7Q2JomShc9X+EjWV60r0pJpV8kXU7mikvc8yuUzZuQ4FdjmzdMtMCVCWViIx4Wrcb K64ywrVvD1Hj5x+CQgO/2uw8Huh5zwKsqNbVT5kbJ/CC/swu+/AJdwFXyrE4wcjsMc7K k/PECVj0YVs5KtVLR/U/VWBVQ5fwvQSAjIIUl7f3cIQEfiF1HjYU1pMe2nlt6MIcCvOB g1QCnkrAMEe0538Y2LR/TNO2F2clGgsHzx85SeB19+BvTJnWq6r0mMHBCdylQAF49TXf iRSQ== X-Forwarded-Encrypted: i=1; AJvYcCUMhN1XF/fwRNHC3z1XlL4FCLa+V2tHuiFwq9tkpQFSQ9gBcyp0FTYk0UODIdgrf5WA3UQMZpV0AwYyvQUD3C4sMasuCWmTebDcHZY7tO4V7xK9l+OHvlf5d1o4L3JN X-Gm-Message-State: AOJu0YwWsHqOfT1J3uyABCQS9dX+mvIAFZvFmkin6lVlqDyTKA8HvtaT +ggp7URUXkx69ohvRa08aXTY+PVAOMoIPCrReBp8tyoC/hE3kPVb X-Google-Smtp-Source: AGHT+IHbCpUQm8FWTaDQdItma3mLn1XydebNeCi95Bwc/oxNRcRMIJfFwIwY++f+16hfSm3B6kDs3w== X-Received: by 2002:a05:600c:4584:b0:426:63b4:73b0 with SMTP id 5b1f17b1804b1-429dd267b7emr16413475e9.34.1723628934957; Wed, 14 Aug 2024 02:48:54 -0700 (PDT) Received: from [192.168.1.28] (86-44-211-146-dynamic.agg2.lod.rsl-rtd.eircom.net. [86.44.211.146]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-429ded32647sm14344215e9.19.2024.08.14.02.48.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 14 Aug 2024 02:48:54 -0700 (PDT) Message-ID: <0d1968e8-64ed-4cdd-9fa5-20b73fe5a497@draigBrady.com> Date: Wed, 14 Aug 2024 10:48:53 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta Subject: Re: bug#72617: sort -n loses lines. To: Simon B , 72617@debbugs.gnu.org References: Content-Language: en-US From: =?UTF-8?Q?P=C3=A1draig_Brady?= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 72617 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) 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 From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 14 07:35:30 2024 Received: (at 72617) by debbugs.gnu.org; 14 Aug 2024 11:35:30 +0000 Received: from localhost ([127.0.0.1]:46304 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1seCHq-00013D-5f for submit@debbugs.gnu.org; Wed, 14 Aug 2024 07:35:30 -0400 Received: from mail-wm1-f54.google.com ([209.85.128.54]:47503) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1seCHo-00012q-1A for 72617@debbugs.gnu.org; Wed, 14 Aug 2024 07:35:28 -0400 Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4280bca3960so50322065e9.3 for <72617@debbugs.gnu.org>; Wed, 14 Aug 2024 04:34:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723635227; x=1724240027; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=RGTM8cm44UHZVJyOZRd/PqMeWEGjGlHXUZdSQA0Waqg=; b=nB3KyFtxJE7vphFNhi6V5mXLIuhoyer2FWVwBaf6pOKRyGVsZyL2JRlaHLata5tpxw 026X1WdCBt+ANHQnaMp8ZdEytWKMZfrjypBk3oVQJfHa2LMvF4AxGoPuU9y2dpRXoZDt FvjYYiyPTtH+5++Suqz0B6eyZAF4yRE43G/3FXVccWdEpTwvtFM7s5cWM7OY/JZhTcDy ZrtMtvmWA+6BOwHm2HhC/cyrddzceLsqMgLzKZXk1vk/LVbHsEPwfVNnPDFFZ1A6bsnW q58+laIU1jAGA2ZfL7D+a688eJD4iPqRnyO+gcy+LmvzXWYryqUsO4AtCyM9y1IPTqf/ hZoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723635227; x=1724240027; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=RGTM8cm44UHZVJyOZRd/PqMeWEGjGlHXUZdSQA0Waqg=; b=lXW7R58vp5h8HYv0umtFXnpxz4DJWfD0eE+XbA0gLpoCDJ+GFMze8ZCahmbzKw37ED SDw7aUZ5OyTS73tFhzlXULR0KybA5XxGud9nox3YtPF0yeY5HWMCqOC9uS6U8wftlDnW KBs4wIFe+KnsJghizIsotbuOyFE/agPckdDAiX5SGaFRj6Ircqa9ARqPb0ztrai5qM6r GjhcrAStgTG/OeZbYgAhU8lLPesYzg93essZu70uBm2LJ8nqrV2GynzjB2AIPgJdgVQ0 Jt/hqVSwl/AdIuQ1ZHTvPSwoOB97vsUfUv1ZBKFYDu+nhO2XzY6+D42LGwa0ftvGuI5R NPgQ== X-Gm-Message-State: AOJu0YzjwSy2NUcws9rAvp5zEuCwEjfFXPL6Pc/BGq5k9PTCfDBw0amZ gHoCzLMpkmzNE1y9pTzOHbxNO0zBkGpVxJd05VhK2bDjVx+AmE5ezhPNig== X-Google-Smtp-Source: AGHT+IFC1sLjJ73fYFcBWjBVPTrO2FsDTAbk+fFOsdwRwEOf1YuwXuC4utiwJfO68m5F6fSPWIXKmg== X-Received: by 2002:a05:600c:190e:b0:428:16a0:1c3f with SMTP id 5b1f17b1804b1-429dd26c6femr19272115e9.32.1723635227065; Wed, 14 Aug 2024 04:33:47 -0700 (PDT) Received: from [192.168.1.28] (86-44-211-146-dynamic.agg2.lod.rsl-rtd.eircom.net. [86.44.211.146]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-36e4c93877bsm12643867f8f.44.2024.08.14.04.33.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 14 Aug 2024 04:33:46 -0700 (PDT) Message-ID: <37afa480-c090-4810-ba7a-431e25a1c952@draigBrady.com> Date: Wed, 14 Aug 2024 12:33:45 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta Subject: Re: bug#72617: sort -n loses lines. To: Simon B References: <0d1968e8-64ed-4cdd-9fa5-20b73fe5a497@draigBrady.com> Content-Language: en-US From: =?UTF-8?Q?P=C3=A1draig_Brady?= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 72617 Cc: 72617@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 14/08/2024 11:04, Simon B wrote: > Hi Pádraig > > I am largely satisfied by your great explanation, > > I am still confused why lines go "missing" though. > > Even if the dot is being interpreted, it still should not lose the > line containing 172.169.6.164 This is actually well explained in the online documentation, so I won't repeat here. See the --unique description at: https://www.gnu.org/software/coreutils/sort cheers, Pádraig From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 14 07:48:01 2024 Received: (at 72617) by debbugs.gnu.org; 14 Aug 2024 11:48:01 +0000 Received: from localhost ([127.0.0.1]:46360 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1seCTx-0001Oq-7t for submit@debbugs.gnu.org; Wed, 14 Aug 2024 07:48:01 -0400 Received: from mail-yw1-f172.google.com ([209.85.128.172]:44516) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1seAu1-000704-Tv for 72617@debbugs.gnu.org; Wed, 14 Aug 2024 06:06:50 -0400 Received: by mail-yw1-f172.google.com with SMTP id 00721157ae682-654cf0a069eso59382307b3.1 for <72617@debbugs.gnu.org>; Wed, 14 Aug 2024 03:06:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723629909; x=1724234709; darn=debbugs.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=oJl8KhppZdY44bzJEAnfwd4GXBTkgwPR0noMZZQ+abI=; b=Y62rXfY+oab13GMU1moexvJtspYA7CG96ScEMZrpNaWQB0takogchtuWa0m5CQUQIQ Lc5QfvMC3Ko12dc7t+oAeCQSP0cYiFY5VTrHIidYR7vf6xkCWvC7EeQt99gY0geVd0xU hc3Pej+2GpQo+Qpnele876t/v4PtZmHI9uzfDY1sPllPlaPJ4qRSTA1Ne04DQK/ltMFE m6pY4jkjXRrraxrvhwh91EwU53gHPHwTlYqXhHZsBAdOfNHZfybyBGuxjPiQ2aw67sTY h9039A3hSxCEZ1t5eIJCFZJF/XrWbXzAzDG36ET6H9+IhdPciDEKoWX2Wloux34usaLk hhPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723629909; x=1724234709; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oJl8KhppZdY44bzJEAnfwd4GXBTkgwPR0noMZZQ+abI=; b=VUBfdlta6pc9CM4bjOgk2OzELXyQNtooZY9IFKXQlTOrlv+I9NJHxjeFLMOxRRv+gS 3B56e/9IWdUqdis7qnx0AvejzvRKmOeHkQ2o7DwesguwoCOeNR24GbD6MrLTe7V+lyKO qKOSh8CbpuzwydgRJEHZ2SFq1MBSQ8mng93nTOtBeUlTTfrnKhtkhPlifRutvJNHxR4R nNsjvMMd1mkNWbF7NwGf0Jp9u8HR09aahHoVr1iixJWfg9FdO7Jibl0Z7bh1H7hoR++V 2HV+dsJihtqcq5BKCK44CKTR1vrkRi5epyaqYypuGKkfDQ9hF77/DtewgAS1CcqHWvHu ySYw== X-Gm-Message-State: AOJu0Yy6Jvrk8sxwngzNutVGiAcLyq5E4SlBZK2+vP4PHtG1je4gnmYZ 5Vtl5BHPP/CTYgigks6uJpYNhbvsK2ccAwW5NTRFBIIvk2L/GNFmHWUjeq9RWqEFx+m2cgHGTH8 91qW9Z5TAAY04C2ORhutMEAKubag= X-Google-Smtp-Source: AGHT+IHllWpy3sW/u9LTmLTWFvD8pJ5k0FXmRv/8hVJlg75AEOJzVli4ZGzDgf/QCNy1PYXItdGVf3uePWWIWgGZ+5Q= X-Received: by 2002:a05:690c:3485:b0:69d:ea8a:e274 with SMTP id 00721157ae682-6ac976454d4mr23185557b3.23.1723629909484; Wed, 14 Aug 2024 03:05:09 -0700 (PDT) MIME-Version: 1.0 References: <0d1968e8-64ed-4cdd-9fa5-20b73fe5a497@draigBrady.com> In-Reply-To: <0d1968e8-64ed-4cdd-9fa5-20b73fe5a497@draigBrady.com> From: Simon B Date: Wed, 14 Aug 2024 12:04:58 +0200 Message-ID: Subject: Re: bug#72617: sort -n loses lines. To: P@draigbrady.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 72617 X-Mailman-Approved-At: Wed, 14 Aug 2024 07:47:59 -0400 Cc: 72617@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Wed, 14 Aug 2024 at 11:48, P=C3=A1draig Brady wrote: > > 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 =E2=80=98en_IE.UTF-8=E2=80=99 sorting= rules > sort: note numbers use =E2=80=98.=E2=80=99 as a decimal point in this loc= ale > 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 =E2=80=98en_IE.UTF-8=E2=80=99 sorting= rules > sort: numbers use =E2=80=98.=E2=80=99 as a decimal point in this locale > 178.128.44.128 > ___ > ___ > __ > ___ > 172.169.6.164 > ___ > ___ > _ > ___ > 172.169.5.249 > ___ > ___ > _ > ___ > Hi P=C3=A1draig I am largely satisfied by your great explanation, I am still confused why lines go "missing" though. Unsorted output # 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]?)' | wc -l 41 Sorted once: # 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 | wc -l 15 Sorted workaround: # 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 -urb | sort -nr | wc -l 17 Even if the dot is being interpreted, it still should not lose the line containing 172.169.6.164 Regards Simon From unknown Thu Jun 19 16:11:26 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 12 Sep 2024 11:24:07 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator