Chinaunix
标题:
grep 命令
[打印本页]
作者:
mmxok
时间:
2011-10-17 01:28
标题:
grep 命令
本帖最后由 mmxok 于 2011-10-17 01:30 编辑
AIX 5.3
想用grep 命令查找 /tmp 目录下(及子目录)文件中包含“sales”关键字的文件。但是要排除/tmp/test这个目录(及子目录)。该怎么弄?自己参考man试了半天无果,请教高人。
grep -rl sales /tmp > /tmp/report 2>/tmp/err 但是怎么跳过那个目录呢,谢谢!
作者:
gilet
时间:
2011-10-17 08:31
回复
1#
mmxok
http://bbs.chinaunix.net/thread-1269369-1-1.html
作者:
mmxok
时间:
2011-10-17 15:51
这个帖子我看过。AIX 5.3 grep 不支持--exclude~~~
作者:
yddll
时间:
2011-10-18 13:45
for i in `ls /tmp`; do if [ $i != test ] ; then cd /tmp; grep -rl sales $i; fi; done
作者:
mmxok
时间:
2011-10-18 19:46
谢谢,shell 编成忘了~~~
欢迎光临 Chinaunix (http://bbs.chinaunix.net/)
Powered by Discuz! X3.2