casio1374633

导航

 

怕忘了,自己记录下.

用find和grep结合查找指定目录下指定类型文件中包含指定字符串的行所在.


查找当前目录下所有c文件中包含stdio.h的行
casio$ find ./ -name '*.c' | xargs grep "stdio.h"
./termios/getpass.c:#include <stdio.h>
./termios/ctermid.c:#include <stdio.h>
./lib.44/cliconn.c:#include <stdio.h>
./signals/abort.c:#include <stdio.h>
./advio/pollpipe.c:#include <stdio.h>
./lib.rhlin/cliconn.c:#include <stdio.h>
./lib.rhlin/strerror.c:#include <stdio.h>
./test/notatty.c:#include <stdio.h>
./test/gdb.c:#include <stdio.h>
./create_data.c:#include <stdio.h>
./environ/opendata.c:#include <stdio.h>
./proc/hellowworld.c:#include <stdio.h>
./proc/nolongjmp.c:#include <stdio.h>
./proc/longjmp.c:#include <stdio.h>
./db.lock.fine/tstats.c:#include <stdio.h>
./db.lock.fine/stats.c:#include <stdio.h>
./lib.sun/exit.c:#include <stdio.h> /* _cleanup() */
./lib.sun/strerror.c:#include <stdio.h>

posted on 2013-04-28 09:47  casio1374633  阅读(268)  评论(0编辑  收藏  举报