免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1289 | 回复: 6
打印 上一主题 下一主题

困惑好长时间了,怎么才能一次grep硬盘上所有的文件? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-07-07 17:36 |只看该作者 |倒序浏览
多谢了!!

论坛徽章:
0
2 [报告]
发表于 2005-07-07 23:38 |只看该作者

困惑好长时间了,怎么才能一次grep硬盘上所有的文件?

find / -type f | xargs grep "patterm".

论坛徽章:
0
3 [报告]
发表于 2005-07-08 19:36 |只看该作者

困惑好长时间了,怎么才能一次grep硬盘上所有的文件?

可以了多谢多谢!!不过还想问问,-type f是什么意思
man了没看明白。谢了

论坛徽章:
0
4 [报告]
发表于 2005-07-08 20:30 |只看该作者

困惑好长时间了,怎么才能一次grep硬盘上所有的文件?

-type c
           True if the type of the file is c, where c is b, c, d,
           D,  f,  l,  p,  or s for block special file, character
           special file, directory, door,  plain  file,  symbolic
           link, fifo (named pipe), or socket, respectively.

i am sure you just want to grep a pattern from a plain  file instead of binary , directory , softlink etc etc , try "ls -l " or "file" command say "file *" to learn the unix file type .

论坛徽章:
0
5 [报告]
发表于 2005-07-11 20:45 |只看该作者

困惑好长时间了,怎么才能一次grep硬盘上所有的文件?

dradhzn,多谢了。明白了

论坛徽章:
0
6 [报告]
发表于 2005-07-12 15:26 |只看该作者

困惑好长时间了,怎么才能一次grep硬盘上所有的文件?

find / -type f -exec grep -l  "patterm"  {} \;

我习惯这样找

论坛徽章:
0
7 [报告]
发表于 2005-07-12 16:04 |只看该作者

困惑好长时间了,怎么才能一次grep硬盘上所有的文件?

  1. man grep:
  2.     -l    Print only the names of  files  with  matching  lines,
  3.            separated  by NEWLINE characters.  Does not repeat the
  4.            names of files when the pattern  is  found  more  than
  5.            once.
复制代码


老姜的法子不好,坏习惯。]
嘻嘻。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP