Date: Tue, 12 Jul 2011 18:52:28 +0400 From: Pan Tsu <inyaoo@gmail.com> To: freebsd-fs@freebsd.org Subject: ignore duplicates (Was: request for review of exports.5 update) Message-ID: <861uxvimab.fsf@gmail.com> References: <10589627.445480.1310418556785.JavaMail.root@erie.cs.uoguelph.ca> <alpine.GSO.1.10.1107111939390.6818@multics.mit.edu> <20110712202759.H1311@besplex.bde.org> <201107120744.26047.jhb@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
John Baldwin <jhb@freebsd.org> writes: > 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"? How about following? - install man page links using symbolic links, not hard links - force zgrep(1) to ignore symbolic links [...] > % 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 "$@" /usr/bin/grep has --exclude which is like your example *still* descends into ignored directories. textproc/gnugrep has --exclude-dir which is similar to using `-or -prune' which makes find(1) to not descend into ignored directories. As for whether it matters to descend here is an example # disable caching metadata/data before test $ zfs set primarycache=none foo/usr/src $ zfs set secondarycache=none foo/usr/src $ time find /usr/src/sys ! -path '*.svn*' >/dev/null $ time find /usr/src/sys ! -path '*.svn*' -or -prune >/dev/null On my 3yo box I don't even need ministat(1) to decide 26.78sr 0.21su 1.09ss 4% 1420k 45s+2194u 217pr+0pf+0w 28377+0io 28394+8935cs 3.68sr 0.07su 0.13ss 5% 1420k 46s+2260u 217pr+0pf+0w 3156+0io 3158+876cs
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?861uxvimab.fsf>