|
|||||||||||
|
Re: Search for string in files
From: Jon Leonard <jleonard(at)oasis.slimy.com>
Date: Sun Aug 26 2007 - 02:47:52 EDT
And if you're interested in sticking with the command line, the invocation you probably want is: find . -name '*.c' | xargs grep 'a_certain_function' The xargs command is almost essential for this sort of activity: It takes its standard input and uses it as additional arguments to the command. It also avoids various limits as to the length of argument lists. The version with 'cat' above could well fail if you have too many findable .c files. The find above takes advantage of grep's default of listing filenames in matches if there's more than one on the command lines. I'm more likely to use a variant like: find . -type f | xargs grep -li pattern That'll search all ordinary files, case insensitive, and only give the names of the matching files. The man pages for find and grep can be very helpful for fine-tuning this kind of search. Jon Leonard -- To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.orgReceived on Sun Aug 26 03:05:26 2007 This archive was generated by hypermail 2.1.8 : Sun Oct 07 2007 - 02:57:24 EDT |
||||||||||
|
|||||||||||