我正在使用此命令,
find -name (file name) -ls | awk '{print $11,"\t",$5,"\t",$7,"\t",$8,$10}'
收集大量文件的信息。但是,如果文件在2018年进行了修改,某些文件给我们应该在何处添加了奇怪的日期,如果您有任何建议将这些数字转换为标准格式,即2016年5月,2017年5月,2018年5月,请问我们是否有此建议。 2017年之前修改的文件的输出没有问题。
有什么办法可以像2018年5月那样以这种格式获取当年的输出?
由于您使用的是Linux,因此可以使用命令的-printf
参数find
:
find -name 'pattern' -printf '%p\t\t%Tb %TY\n'
样本输出:
$ find -name 'file*' -printf '%p\t\t%Tb %TY\n'
./file1 Sep 2018
./file6 Sep 2018
./file4 Sep 2018
./file2 Sep 2018
./file3 Sep 2018
./file5 Sep 2018
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句