根据手册页,我们对 sort 命令的 --numeric-sort 选项进行了以下描述。
-n, --numeric-sort
compare according to string numerical value
Run Code Online (Sandbox Code Playgroud)
我假设,通过字符串数值,我们的意思是通过其 ASCII 值连续比较每个字符串字符?
信息页阅读
‘-n’
‘--numeric-sort’
‘--sort=numeric’
Sort numerically. The number begins each line and consists of
optional blanks, an optional ‘-’ sign, and zero or more digits
possibly separated by thousands separators, optionally followed by
a decimal-point character and zero or more digits. An empty number
is treated as ‘0’. The ‘LC_NUMERIC’ locale specifies the
decimal-point character and thousands separator. By default a
blank is a …
Run Code Online (Sandbox Code Playgroud) sort ×1