ignore duplicates (Was: request for review of exports.5 update)
Pan Tsu
inyaoo at gmail.com
Tue Jul 12 14:52:45 UTC 2011
John Baldwin <jhb at 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
More information about the freebsd-fs
mailing list