[Trisquel-users] Sort and Uniq fail to remove all duplicates from a list of hostnames and their IPv4 addresses

amenex at amenex.com amenex at amenex.com
Sun Feb 17 15:31:00 CET 2019


Magic Banana does it again ... with "tr -s ' ' < file | sed 's/ $//' | sort  
-u"

I plugged in the filename thusly:

 > tr -s ' ' < HolkitsorN.txt | sed 's/ $//' | sort -u > HolkitsorN-MBd.txt

With the result that the original 13.1 kB shrank to 8.8 kB, without any  
residual duplicate lines.

The LibreOffice Calc spreadsheet shrank from 332 rows to 224 rows; before  
sorting and trying
to remove duplicates, just with Libreoffice Calc, there were 2461 rows.  
Clearly, this has to
be a multi-step process. Sort -u by itself had no effect on the file size ...  
even after I
"laundered" the file by emailing it to myself and copying it from the email  
text into Leafpad.

I tried to parse MB's expression ... I'm OK until sed 's/ $//' because in man  
sed it looks like
it might be sed 's///' instead. Am I missing something ?

A residual task remains: The sorting process only works for me if I pad the  
one- and two-digit
octets with leading zeroes ... which have to be stripped out afterwards. Is  
there a "sort" in
any freedom-compatible application which can put numbers in numerical order ?

Thanks & best regards,
George Langford


More information about the Trisquel-users mailing list