On Tue, 14 Feb 2006, Michael Schmidt wrote:
> Matthias Kilian wrote:
>
> > And watch out for silly file names containing whitespace.
> >
> > BTW: if this is a contest on creative use of find(1) and other
> > standard tools:
> >
> > $ find . -type f | sed '[EMAIL PROTECTED]@grep -l -- foo @' | sh
> >
> > Yes, this isn't robust against whitespace, either PLUS it's
> > inefficient. But in some cases the find ... | sed ... | sh pattern
> > is quite useful.
> >
>
> Sometime ago I have had the same problem with spaces in filenames and dealing
> with them as xargs parameters. There I have used (here only as an example):
>
> find . -print | grep -i ' ' | xargs -I {} ls -ald {}
>
> FYI, that has been on a non-OpenBSD system.
> I4m not at my OpenBSD system at the moment, so I can4t check whether OpenBSD
> xargs supports the shown options. Maybe someone may test it.
>
> One may check this at a directory with space-containing filenames.
> Without the "-I {}" and "{}" parts you get funny output.
>
Well, -print0 in find and xargs -0 are designed to deal with that.
Sadly these are not in POSIX (which is not documented correctly in the
xargs case).
-Otto