Hello.
The bug is in using "sort -nu" in a pipe after the output of IP addresses list. Every line is only something like "1.2.3.4".

The problem is the same on these two different distributions:
1) Linux li302-235 5.1.17-x86_64-linode128 #1 SMP PREEMPT Wed Jul 10 17:11:49 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux (is an Ubuntu 2) Linux pepe.mi.bo.it 2.6.32-754.25.1.el6.x86_64 #1 SMP Mon Dec 23 15:19:53 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux (is a CentOS 6.10)

Given a list of IP addresses the command lines:
# cat controllareARCHIVIO_2020/02/controllare20200213.txt | wc -l
1264
That's the number of lines without sort

# cat controllareARCHIVIO_2020/02/controllare20200213.txt | sort -u | wc -l
1262
That's the number of unique lines with sort --unique

# cat controllareARCHIVIO_2020/02/controllare20200213.txt | sort -nu | wc -l
685
That IS NOT the number of unique lines! Why ordering them numerically should change the number?

In fact, separating the parameters:
# cat controllareARCHIVIO_2020/02/controllare20200213.txt | sort -u | sort -n | wc -l
1262
we workaround the bug.

I did not find any report of this on https://lists.gnu.org/archive/html/bug-coreutils/
so I wrote.

I am available for further explication.

Thanks in advance,
Best Greetings

--

STEFANO PEDERZANI

Amministratore di Sistemi Informatici
System Administrator
Amministratore di Database
Database Administrator

Email:
stefano.pederz...@tiscali.it
Tel. +39 347 1645440

www.icomeinformatica.com



Reply via email to