问题描述
你能告诉我是否有一种方法可以对如下数据卷数进行排序:
想根据第一列对以下行进行排序
7.9G User1 2020-05-07
529M User2 2020-04-24
49M User3 2020-04-29
43M User4 2020-04-23
谢谢
解决方法
对于 GNU 排序,使用 sort -k1,1h file
选项:
man sort
来自-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.
:
var val = 'true';
console.log(val.trim().toLowerCase()==='true');