文件夹中使用grep

在linux使用中,grep算是使用频率很高的一个命令了,今天需要在文件夹中查找一个字符串,受不了win下的速度,就在linux里面试试,特在此做个笔记,呵呵。

查看指定程序运行的情况,我们可以通过,:

ps aux | grep ‘bash’

来进行筛选指定的程序,在文件中查收也类型,同时可以加上强大的的正则表达式

grep ‘^test’file

在文件夹中查找

同样的我们在整个文件夹里面进行查找包含指定字符串的文件,即使包含在二进制文件中也逃不出grep的魔爪,呵呵,比如我要在debug目录中查找包含fhmainctl字符串的文件:

grep fhmainctl .  –r

查找结果:

[root@bld112 montavista]# grep fhmainctl -r .
./fhagentflst:        $(OBJDIR)/fhmainctl01.o
Binary file ./debug/fhsi matches
Binary file ./debug/fhagent.o matches
Binary file ./debug/fhmainctl01.o matches
Binary file ./debug/libfhagent.a matches

其实就是加了一个-r参数,就搞定了,man grep看看,怎么解释的

-R, -r, –recursive
             Read all files under each directory, recursively; this is equivalent to the -d recurse option.

当然通过

find . | xargs grep fhmainctl

查找结果也是一样的

无觅相关文章插件,快速提升流量


发表评论

电子邮件地址不会被公开。 必填项已用 * 标注

*


您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Bad Behavior has blocked 1476 access attempts in the last 7 days.

site tracking with Asynchronous Google Analytics plugin for Multisite by WordPress Expert at Web Design Jakarta.

serial corel draw 11

serial corel draw 11 serials

free corel photoshop download

free corel photoshop download keygen

adobe free

adobe free

key office 2010

office 2010 key

download photo shop free

photo shop serial

free winrar download for xp

download winrar for xp for free

windows 7 free

windows 7 crack

cs5 serialz

cs5 serialz free

free corel downloads

free corel downloads cracked

office 2010 free

office 2010 key

winrar password cracker serial

wirar password cracker

serial winzip 11

serial winzip 11 key

photoshop key

photoshop key

windows key

windows key

corel dvd moviefactory 6

corel dvd moviefactory 6 downloads

office 2010 professional key

office 2010 key

photo shop key

photo shop key

winrar 3 download

winrar 3 download freedownload

windows 7 key

windows 7 key