Grep Guru

Giorgos Keramidas keramida at ceid.upatras.gr
Mon Jun 9 14:28:41 UTC 2008


On Sun, 08 Jun 2008 22:23:19 +0200, Simon Jolle sjolle <urandomdev at gmail.com> wrote:
> On 06/08/2008 10:12 PM, Bill Campbell wrote:
>> On Sun, Jun 08, 2008, Jos Chrispijn wrote:
>>> I tried to make a grep script on find a string in all files on path
>>> ./ and down. It does anything exept searching in files and reporting
>>> them.  Is there a Grep Guru who can hint me out? Thanks,
>>
>> I expect you need something like:
>>
>> find . -type f -print0 | xargs -0 grep pattern
>
> Or install the GNU grep (from the man)
>
> -R, -r, --recursive
> Read all  files  under  each  directory,  recursively;  this  is
> equivalent to the -d recurse option.

/usr/bin/grep *is* GNU grep in FreeBSD:

% keramida at kobe:/home/keramida$ grep --version
% grep (GNU grep) 2.5.1-FreeBSD
%
% Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc.
% This is free software; see the source for copying conditions. There is NO
% warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
%
% keramida at kobe:/home/keramida$

AFAIK, Gabor Kovesdan is working on replacing grep(1) with a
BSD-licensed implementation, but he also tries to keep UI
compatibility as much as possible.  So I guess the -r/-R option
should work in that version too once it hits the tree.



More information about the freebsd-questions mailing list