Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Jul 2011 07:44:25 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-fs@freebsd.org
Subject:   Re: request for review of exports.5 update
Message-ID:  <201107120744.26047.jhb@freebsd.org>
In-Reply-To: <20110712202759.H1311@besplex.bde.org>
References:  <10589627.445480.1310418556785.JavaMail.root@erie.cs.uoguelph.ca> <alpine.GSO.1.10.1107111939390.6818@multics.mit.edu> <20110712202759.H1311@besplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday, July 12, 2011 6:50:09 am Bruce Evans wrote:
> BTW, does anyone know a good way of not seeing duplicates in commands
> like "zgrep -r wrt /usr/share/man"?  find(1) doesn't seem to have any
> flag to suppress duplicates.  du(1) has to know how to not count
> duplicates internally.  I think it as special code for this and there
> is no special support for this in fts(3).  Recently I have been annoyed
> by duplicates under .svn.  I want to type a simple grep -r or
> "find . | xargs grep" without any complicated pattern for the file names
> and not see multiple copies.

I actually have resorted to using specialized commands and aliases for
doing diffs and greps in source trees.  From my .cshrc:

alias cvsdiff   diff -uprN -x \'\*~\' -x \'\*.o\' -x \'\*.orig\' -x \'\*.rej\' 
-x compile -x CVS -x .svn -I \'\\\$FreeBSD\'
alias cvsndiff  diff -upr -x \'\*~\' -x \'\*.o\' -x \'\*.orig\' -x \'\*.rej\' 
-x compile -x CVS -x .svn -I \'\\\$FreeBSD\'

(cvsndiff doesn't include new files)

And a script I keep in my ~/bin:

% cat kgrep
#!/bin/sh
#
# Grep inside a kernel directory skipping compile directories and revision
# control directories

find `ls` ! -path '*compile*' ! -path '*.svn*' ! -path '*CVS*' \
    ! -path '*cscope*' ! -type d -print0 | xargs -0 grep -H "$@"

I also use cscope and xcscope.el to navigate kernel trees which is faster
than grep for cases where it works.

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201107120744.26047.jhb>