Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 2D18740D157 for ; Fri, 29 Oct 2010 01:42:54 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.899 X-Spam-Level: X-Spam-Status: No, score=-1.899 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001] autolearn=ham Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lpbS9SLpt8-b for ; Fri, 29 Oct 2010 01:42:43 -0700 (PDT) Received: from smtp2-g21.free.fr (smtp2-g21.free.fr [212.27.42.2]) by olra.theworths.org (Postfix) with ESMTP id B16FC40D152 for ; Fri, 29 Oct 2010 01:42:42 -0700 (PDT) Received: from coriolan (unknown [88.172.133.112]) by smtp2-g21.free.fr (Postfix) with ESMTP id 9854F4B005A for ; Fri, 29 Oct 2010 10:42:36 +0200 (CEST) Date: Fri, 29 Oct 2010 10:42:12 +0200 From: =?UTF-8?B?RnJhbsOnb2lz?= Gannaz To: notmuch@notmuchmail.org Subject: Re: Notmuch scripters rejoice! New "notmuch search --output=(...)" Message-ID: <20101029104212.73d9cac8@coriolan> In-Reply-To: <8762wmglxe.fsf@yoom.home.cworth.org> References: <8762wmglxe.fsf@yoom.home.cworth.org> X-Mailer: Claws Mail 3.7.6cvs12 (GTK+ 2.20.1; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2010 08:42:54 -0000 On 2010-10-28, Carl Worth wrote: > I just added a new feature to notmuch that I've been wanting for a very > long time. It's a new option to "notmuch search" as follows: >=20 > --output=3D(summary|threads|messages|files|tags) >=20 > The "summary" value is the default and behaves as "notmuch search" > always has, (printing a one-line summary with a bunch of information > about each thread). >=20 > Each of the other options causes "notmuch search" to print only a single > value, (thread ID, message ID, filename, or tag), one-per-line[*]. This > is intended to be useful in scripts to do things as follows: >=20 > for spamfile in $(notmuch search tag:spam); do > rm $spamfile > done >=20 > Or what have you. >=20 > I hope people find this useful. See "notmuch help search" for more > details. Going from : my $notmuch =3D `notmuch show @ARGV`; my @filenames =3D (); while ($notmuch =3D~ /^\x{0c}message{ .+filename:(.+)$/mg) { push @filenames, $1; } to : my @filenames =3D split /\n/, `notmuch search --output=3Dfiles @ARGV`; Thanks, that will clearly enhance my script. -- Fran=C3=A7ois