当前位置: 技术问答>linux和unix
find 命令
来源: 互联网 发布时间:2016-04-17
本文导语: 我用find 命令 在当前目录下找 "iamok"的字段 怎么找啊???? 用find行不 ??? 目录如下: aan anim.ksh count f1 file shell sort t2 test1 test3 test_a tt anim animals dd f2 sh1 shlist t1 ...
我用find 命令 在当前目录下找 "iamok"的字段 怎么找啊????
用find行不 ???
目录如下:
aan anim.ksh count f1 file shell sort t2 test1 test3 test_a tt
anim animals dd f2 sh1 shlist t1 test test2 test4 test_k
-----------------------
grep iamok *
f1:iamok
不用grep可以不 ????
用find行不 ???
目录如下:
aan anim.ksh count f1 file shell sort t2 test1 test3 test_a tt
anim animals dd f2 sh1 shlist t1 test test2 test4 test_k
-----------------------
grep iamok *
f1:iamok
不用grep可以不 ????
|
find主要是用作查找匹配的文件或者目录(是和文件或者目录名匹配)!
如果你是要查找与文件中匹配的字符串,那么还是用grep把!
grep iamok ./ -R
其中 -R 是递归选项,可以递归查下级子目录!
Good Luck!
如果你是要查找与文件中匹配的字符串,那么还是用grep把!
grep iamok ./ -R
其中 -R 是递归选项,可以递归查下级子目录!
Good Luck!
|
如果要查找的字段是文件或者目录名,可以不用,命令:find . -name *iamok* -print
|
学习
|
find ./ -name "*.*" |xargs grep iamok
|
man find
info fina
thanks
|
find是用来搜索文件名的,而你想搜索文件内容,所以还是用grep
|
If you *really* want to use find, here is how:
find . -exec grep 'iamok' {} ;
find . -exec grep 'iamok' {} ;
|
find . -type f -exec grep -H "iamok" {} ;
这样可以查找到当前目录及其子目录下面包括 iamok 字符串的所有文件了。
试试看!
这样可以查找到当前目录及其子目录下面包括 iamok 字符串的所有文件了。
试试看!
|
find . -name "iamok"
|
grep sed awk 都可以查字段 find 是查询文件或目录的
|
find ./ -name "*.*" -exec grep "iamok" {} ; -print
这个命令好用极了,呵呵!
这个命令好用极了,呵呵!