Linux 查找文件并 grep 然后按日期列出
我正在尝试查找名称为 formClass.php
且包含 checkCookie 字符串的文件,并且我想按日期列出文件,显示日期、大小、所有者和团体。这些文件位于我的主目录中。
我可以正常工作,但它不显示日期、所有者等...
find /home -name formClass.php -exec grep -l "checkCookie" {} \;
我想我可以将“trhg”添加到这样的列表中,但它不起作用:
find /home -name formClass.php -exec grep -ltrhg "checkCookie" {} \;
谢谢
I'm trying to find files with the name of formClass.php
that contain a string of checkCookie and I want to list the files by date showing the date, size, owner and the group. The files are in my home directory.
I have this working, but it doesn't show date, owner, etc...
find /home -name formClass.php -exec grep -l "checkCookie" {} \;
I was thinking that I could add "trhg" to the list like this, but it didn't work:
find /home -name formClass.php -exec grep -ltrhg "checkCookie" {} \;
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试find /home -name formClass.php -print0 | xargs -0 grep -l --null checkCookie | xargs -0 grep -l --null checkCookie | xargs -0 grep -l --null checkCookie | xargs -0 grep -l --null xargs -0 ls -l
Try
find /home -name formClass.php -print0 | xargs -0 grep -l --null checkCookie | xargs -0 ls -l
查看
man ls
了解其他排序选项。Take a look at
man ls
for another sorting options.似乎有几种方法可以做到这一点。我发现了这个并且它对我有用。
感谢您的其他建议。
It seems there are a few ways to do this. I found this and it worked for me.
thank you for the other suggestions.