coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: question on using the -n option for sorting


From: Chris Elvidge
Subject: Re: question on using the -n option for sorting
Date: Sun, 3 Nov 2024 15:21:31 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 Lightning/5.4

On 03/11/2024 at 01:48, American Citizen wrote:
Hello:

I am a number theory mathematician, using linux as a computer platform for my studies.

In using the sort command with the -n option, such as the command

%sort -k3,3n close.2 > close.3

I noticed that the 93 digits in the 3rd field are NOT numerically ordered, although most were.

Not all your lines in example.sort have 93 characters in the 3rd field. I've found 91,92,93,94 and 95.

sort -k3,3n example.sort | awk '{printf "%5s %5s %95s %s\n", $1, $2, $3, length($3)}'



I switched to the dictionary order

%sort -k3,3 close.2 > close.3

and then close.3 seems to be in the correct numerical sequence in field 3.

Can anyone share with me how many digits the -n option can safely sort? Can we do decimals > 17 digits with this option? Can sort be strengthened to handle digits > 17 ?

Thank you for letting me know. I attach a short 100 line sample file which was extracted from the 29,984 line actual close.2 file.

Randall



--
Chris Elvidge
England




reply via email to

[Prev in Thread] Current Thread [Next in Thread]