From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27495 invoked by alias); 23 Nov 2016 10:40:16 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 22128 Received: (qmail 2009 invoked from network); 23 Nov 2016 10:40:16 -0000 X-Qmail-Scanner-Diagnostics: from mail-wm0-f47.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(74.125.82.47):SA:0(-0.0/5.0):. Processed in 1.206866 secs); 23 Nov 2016 10:40:16 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: andipersti@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 74.125.82.47 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=pxhAVYFOkcRfIs5CIrFC0HXi5hRC3UCnXSAuMj4kfro=; b=zdYMihm6/g1vfp8D4OpUV7hA7PnMrm1euIDS1v1XkRwKvl/ADylFtt+41xqSwA4IMY RoNZWdA54WgoEZFPBkMwJ5l6CTPqle3ZbIag55HMf91NYU6SzprJJOcQ7s72hln+8f9S w4BwWZECqf0gdWxJLNLHefHn1HnjQujNkR6Wp6AMMrlaB9M93x0BZoMwzHbYPI1EUDEd 2nXPyrmiY4Xr5QNVppbiRzu0VTcNhdiYX3J67BU3yvmcOhpSo5gDQ7ZzN2kEQrmjxDJp xwE3Ykj/KxnXJylwuxAqcjYdlRIppFB0KdvbEfn46oIFufFzzwH5GHgoxJoz/6+F/KNh Jlvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=pxhAVYFOkcRfIs5CIrFC0HXi5hRC3UCnXSAuMj4kfro=; b=P9u0soBzbanK+bnjnBOO0S6W7Gv2PanmaWoZcvDtWdsKbdcWZkJdjYwy4zMnBDayLg kvdeW46cOVq6B5XOUVLcxC0catS7u6j9EkMRMgPojWDYvaId8ovsy46IYXIqG+MW1Z4t bN7i4GUmN5fGbYnxYz37XBDf/iv0KBzj1zDvzi5HtYxmTyMD/vGaYNPKTkDyAqgKBMAQ LTm0Zu0blCHdKEuTRqkHfu3n0IcdD/JMcaYZNPFqdIo0rLozjKDgaTyqFgnSsiCnXBuP Dvr3oa+MMVqbOpB9nD4qGIQfQUNpbZiNlDlw/yrF4vELKo8SuV0dmRCCjChQhibiIml2 Ai4A== X-Gm-Message-State: AKaTC00Gac1dj3Ql5jLzgwXz+7vnpRIOqeUKvsC9ysI2YzNAmfCdyyMOgbS/+kCqt3FLBg== X-Received: by 10.194.47.138 with SMTP id d10mr2590515wjn.83.1479894020678; Wed, 23 Nov 2016 01:40:20 -0800 (PST) Subject: Re: Emulating 'find's print0... To: zsh-users@zsh.org References: <20161123072454.GA4898@solfire> From: Andreas Perstinger Message-ID: <3fa9ba29-a34a-f5fb-a23a-7bbdbc622da9@gmail.com> Date: Wed, 23 Nov 2016 10:40:19 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161123072454.GA4898@solfire> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 2016-11-23 08:24, Meino.Cramer@gmx.de wrote: > cat-ting a list of file like so > > cat files.txt | xargs md5sum | sort | ......... > > fails, if a files name contains blanks. > > The tool find circumvent this by using print0 > and xargs understands this via -0. > > But I dont want to use find in this case, since the > list of files (files.txt) are hand made and a manual > selection of files. > > Is there any way to emulate "-print0" efficiently > (that is: without accessing the drive again) ? You could use the -I option of xargs: $ cat files.txt test 1 test2 test with more blanks $ cat files.txt | xargs -I @ md5sum @ | sort 26ab0db90d72e28ad0ba1e22ee510510 test2 6d7fce9fee471194aa8b5b6e47267f03 test with more blanks b026324c6904b2a9cb4b88d6d61c81d1 test 1 With "-I replstr", xargs always takes a full line and replaces every occurence of "replstr" in the argument list of the utility with that line. The GNU version of xargs also has the -a option which eliminates the cating: $ xargs -a files.txt -I @ md5sum @ | sort 26ab0db90d72e28ad0ba1e22ee510510 test2 6d7fce9fee471194aa8b5b6e47267f03 test with more blanks b026324c6904b2a9cb4b88d6d61c81d1 test 1 Bye, Andreas