Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Bash 排序数据卷号_Bash_Shell_Scripting - Fatal编程技术网

Bash 排序数据卷号

Bash 排序数据卷号,bash,shell,scripting,Bash,Shell,Scripting,您能告诉我是否有办法对数据卷编号进行如下排序: 要根据第一列对以下行进行排序吗 7.9G User1 2020-05-07 529M User2 2020-04-24 49M User3 2020-04-29 43M User4 2020-04-23 感谢使用GNU排序,请使用-h选项: sort -k1,1h file 从人工分拣: -h, --human-numeric-sort compare human readable num

您能告诉我是否有办法对数据卷编号进行如下排序:

要根据第一列对以下行进行排序吗

7.9G User1   2020-05-07     
529M User2  2020-04-24 
49M User3   2020-04-29 
43M User4   2020-04-23 
 


 

感谢使用GNU排序,请使用
-h
选项:

sort -k1,1h file
人工分拣

-h, --human-numeric-sort 
      compare human readable numbers (e.g., 2K 1G)

-k, --key=KEYDEF
      sort via a key; KEYDEF gives location and type

KEYDEF  is  F[.C][OPTS][,F[.C][OPTS]] for start and stop position,
where F is a field number and C a character position in the field;
both are origin 1, and the stop position defaults to the line's end.

这里已经回答了这个问题: