Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Sep 2008 13:51:22 +0200
From:      Ulrich Spoerlein <uspoerlein@gmail.com>
To:        freebsd-hackers@FreeBSD.ORG, koitsu@FreeBSD.ORG
Subject:   Re: Extending find(1) to support -printf
Message-ID:  <20080913115122.GK76117@roadrunner.spoerlein.net>
In-Reply-To: <200809081347.m88DlK8T074926@lurza.secnetix.de>
References:  <20080905143915.GA60002@icarus.home.lan> <200809081347.m88DlK8T074926@lurza.secnetix.de>

next in thread | previous in thread | raw e-mail | index | archive | help
Pretty late to the game, but ...

On Mon, 08.09.2008 at 15:47:20 +0200, Oliver Fromme wrote:
> Jeremy Chadwick wrote:
> > Equally as frustrating, mutt's backtick support will only honour the
> > first line of input.  If a backticked command returns multiple lines,
> > only the first is read; the rest are ignored.
> 
> Well, you can convert back and forth between spaces
> and newlines with tr(1):
> 
> echo * | tr ' ' '\n' | grep -v whatever | tr '\n' ' '

If your data is not very large, you can also fool xargs(1) into doing
the conversion for you

$ echo * | xargs -n1
and
$ ls -1 | xargs

> It's not pretty, but it should work.  Note that ls(1)
> prints one file name per line, so you can simplify the
> above line like this:
> 
> ls | grep -v whatever | tr '\n' ' '
> 
> By the way, I often use zsh in such cases.  It supports
> "extended globbing", for example, the wildcard expression
> *~*.(gz|bz2) matches all files _except_ the ones that end
> with .gz or .bz2.

Indeed much more useful than fighting with find(1) and passing the file
lists around.

Cheers,
Ulrich Spoerlein
-- 
It is better to remain silent and be thought a fool,
than to speak, and remove all doubt.



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