日志时间格式有s,ms,us,如何排序最大10行
这个比较繁琐,谁有更好方法?告诉我
[root@module tmp]# cat oldboy.txt
12s
120001ms
12000000us
13s
[root@module tmp]# grep '[0-9]\+s' oldboy.txt |sed 's#s#000000#g'>oldboy1.txt
[root@module tmp]# cat oldboy1.txt
12000000
13000000
[root@module tmp]# grep '[0-9]\+us' oldboy.txt |sed 's#us##g'>>oldboy1.txt
[root@module tmp]# cat oldboy1.txt
12000000
13000000
12000000
[root@module tmp]# grep '[0-9]\+ms' oldboy.txt |sed 's#ms#000#g'>>oldboy1.txt
[root@module tmp]# cat oldboy1.txt
12000000
13000000
12000000
120001000
[root@module tmp]# cat oldboy1.txt |sort -n
12000000
12000000
13000000
120001000
12s
120001ms
12000000us
13s
[root@module tmp]# grep '[0-9]\+s' oldboy.txt |sed 's#s#000000#g'>oldboy1.txt
[root@module tmp]# cat oldboy1.txt
12000000
13000000
[root@module tmp]# grep '[0-9]\+us' oldboy.txt |sed 's#us##g'>>oldboy1.txt
[root@module tmp]# cat oldboy1.txt
12000000
13000000
12000000
[root@module tmp]# grep '[0-9]\+ms' oldboy.txt |sed 's#ms#000#g'>>oldboy1.txt
[root@module tmp]# cat oldboy1.txt
12000000
13000000
12000000
120001000
[root@module tmp]# cat oldboy1.txt |sort -n
12000000
12000000
13000000
120001000