On Tue, Oct 23, 2012 at 8:04 PM, Todd Fischer <[email protected]> wrote:
> I use a tool, finds, I got from someone about 15 years ago. It simply does
> a recursive look for a string in all files of interest in a directory tree.
> When I get a big tarball of code that I don't intend to build, but want to
> grab some logic, I use finds. I have created a variety of variations of
> finds (which I usually later throw away) as my search needs change.
> Essentially finds is
>
> find . -exec fgrep -H "$1" {} \;
>
> but with lots and lots of other qualifiers. You can see a usable version at
>
> https://www.ridgerun.com/developer/wiki/index.php/Tip_of_the_day#finds_-_find_a_string_in_common_text_files
Why not to use options of modern grep? Here is example:
g()
{
/bin/grep "$@" \
--recursive --line-number --color \
--no-messages --binary-files=without-match --devices=skip
--exclude-dir=.svn --exclude-dir=.git
--exclude-from=exclude-patterns.list \
--exclude-dir arch arch/$ARCH
}
PS: fill file exclude-patterns.list with pattern to exclude ( *~,
*.mod.c, *.o.cmd )
or just use grep $PATTERN $DIR -r --include=*.[chS] --color
you can also use variable GREP_OPTIONS
--
Constantine Shulyupin
http://www.MakeLinux.com/
Embedded Linux Systems,
Device Drivers, TI DaVinci
_______________________________________________
Celinux-dev mailing list
[email protected]
https://lists.celinuxforum.org/mailman/listinfo/celinux-dev