【发布时间】:2013-06-14 02:32:34
【问题描述】:
我有一个目录,里面有一堆带有数字文件名的文件。它们没有前导零,所以如果我在该目录中执行grep hello * 之类的操作,我可能会得到如下信息:
22:hello, world!
6:hello
62:"Say hello to them for me."
我宁愿结果是这样的:
6:hello
22:hello, world!
62:"Say hello to them for me."
我的第一个想法是使用grep hello * | sort -n 对结果进行数字排序,但后来我失去了 grep 的颜色,我想保留这些颜色。最好的方法是什么?
【问题讨论】: