grep 和find 结合

来源:互联网 发布:网络售彩最新消息 编辑:程序博客网 时间:2024/05/19 13:21

用grep命令在所有的普通文件中搜索hostname这个词:

 

# find . -type f -print | xargs grep "hostname"
./httpd1.conf:#     different IP addresses or hostnames and have them handled by the
./httpd1.conf:# VirtualHost: If you want to maintain multiple domains/hostnames
on your

 

用grep命令在当前目录下的所有普通文件中搜索hostnames这个词:

 

# find . -name /* -type f -print | xargs grep "hostnames"
./httpd1.conf:#     different IP addresses or hostnames and have them handled by the
./httpd1.conf:# VirtualHost: If you want to maintain multiple domains/hostnames
on your

原创粉丝点击