SunOS按日期排序

时间:2016-03-25 21:00:45

标签: sorting unix find exec solaris

我目前在目录上运行以下内容:

find `pwd` -type f -exec grep -s -i -l '$string' {} + | xargs -L 1 ls -lrthg | sort -k7 -k6

按日期(年)排列所有返回的文件。我接近我想要的但我无法按顺序排序所有月份。

我在旧版本的SunOS(5.10)上运行。

我无法升级或安装任何内容,因此这是一项挑战。我也不能使用perl。非常感谢帮助。

From bottom up (1) From bottom up (2)

1 个答案:

答案 0 :(得分:0)

使用标准Solaris命令可以实现以下目标:

find . -type f -exec grep -sil "$string" {} + | xargs -L 1 ls -Erth | sort -k 6,7