Linux查找文件和grep,然后按日期列出

问题描述

| 我正在尝试查找名称为“ 0”的文件,其中包含一个checkCookie字符串,我想按日期列出这些文件,以显示日期,大小,所有者和组。这些文件在我的主目录中。 我有这项工作,但没有显示日期,所有者等。
find /home -name formClass.php -exec grep -l \"checkCookie\" {} \\;
我当时以为可以在列表中添加\“ trhg \\”,但是它不起作用:
find /home -name formClass.php -exec grep -ltrhg \"checkCookie\" {} \\;
谢谢     

解决方法

试试
find /home -name formClass.php -print0 |  xargs -0 grep -l --null checkCookie | xargs -0 ls -l
    ,
ls -lt `grep -lr --include=formClass.php \"checkCookie\" *`
看一下
man ls
还有另一个排序选项。     ,似乎有几种方法可以做到这一点。我找到了,它对我有用。 找到/ home -name formClass.php -exec grep -l \“ checkCookie \” {} \\; | xargs ls -ltrhg 感谢您的其他建议。     

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...