Extending find(1) to support -printf
Ulrich Spoerlein
uspoerlein at gmail.com
Sat Sep 13 12:23:20 UTC 2008
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.
More information about the freebsd-hackers
mailing list