Chinaunix

标题: 困惑好长时间了,怎么才能一次grep硬盘上所有的文件? [打印本页]

作者: jj7_2003    时间: 2005-07-07 17:36
标题: 困惑好长时间了,怎么才能一次grep硬盘上所有的文件?
多谢了!!
作者: dradhzn    时间: 2005-07-07 23:38
标题: 困惑好长时间了,怎么才能一次grep硬盘上所有的文件?
find / -type f | xargs grep \"patterm\".
作者: jj7_2003    时间: 2005-07-08 19:36
标题: 困惑好长时间了,怎么才能一次grep硬盘上所有的文件?
可以了多谢多谢!!不过还想问问,-type f是什么意思\r\nman了没看明白。谢了
作者: dradhzn    时间: 2005-07-08 20:30
标题: 困惑好长时间了,怎么才能一次grep硬盘上所有的文件?
-type c\r\n           True if the type of the file is c, where c is b, c, d,\r\n           D,  f,  l,  p,  or s for block special file, character\r\n           special file, directory, door,  plain  file,  symbolic\r\n           link, fifo (named pipe), or socket, respectively.\r\n\r\ni 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 .
作者: jj7_2003    时间: 2005-07-11 20:45
标题: 困惑好长时间了,怎么才能一次grep硬盘上所有的文件?
dradhzn,多谢了。明白了
作者: samshi    时间: 2005-07-12 15:26
标题: 困惑好长时间了,怎么才能一次grep硬盘上所有的文件?
find / -type f -exec grep -l  \"patterm\"  {} \\;\r\n\r\n我习惯这样找
作者: ga0feng    时间: 2005-07-12 16:04
标题: 困惑好长时间了,怎么才能一次grep硬盘上所有的文件?
  1. man grep:\r\n    -l    Print only the names of  files  with  matching  lines,\r\n           separated  by NEWLINE characters.  Does not repeat the\r\n           names of files when the pattern  is  found  more  than\r\n           once.
复制代码
\r\n\r\n老姜的法子不好,坏习惯。]\r\n嘻嘻。




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2