From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5876 invoked by alias); 23 Nov 2016 16:39:38 -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: 22129 Received: (qmail 5959 invoked from network); 23 Nov 2016 16:39:38 -0000 X-Qmail-Scanner-Diagnostics: from mail-qt0-f174.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(209.85.216.174):SA:0(-0.7/5.0):. Processed in 1.226446 secs); 23 Nov 2016 16:39:38 -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.7 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_DNSWL_LOW,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: mikachu@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 209.85.216.174 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=FKjQLo70mmW/FLscw/fiI2dCZicAKnWTcqSzV9fBZDU=; b=utdzWYB4Xfg4gig3P2yrPbiQS9GErp4XlsppPeCDGFsrNEHbXz1/mySA8daQzD/0/I e5+pP8MJOQYK8wnffjbzHXIQfX24kd9ncoNoio+NZlhT3JgoVNFCFAg3SdsDSn5XDunn +tDuGgDKUUnj5fQyOPKnLNrCDfky5HDNwxiM9wpRyX/3yklCJa/ztXgXzhZE2TTSXQCu gADTZWFlUnRtxgIIrRBomaRh9Evq28VQLDwc3wRj6vOMVctYhoqk9KvkymrjoJcrgQ0H qQbJE2FhjayMdzT8bJdwQZl1Yyb1v76FZ9N2Fkxiy7KQ85t0qx2I5pINNvUYdHi/AbDU aMiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=FKjQLo70mmW/FLscw/fiI2dCZicAKnWTcqSzV9fBZDU=; b=AxTi9qbuxsazM+EuSxS+VMiMq7zDWt628Jq79F1nGnf3KmqQjnLTZYInwWKlgAJuN9 7jWJ4TpZ6CzVJyDd1tLAapCYUhEF6pkAz4Gk8wV/g9fKfeinwiuxo7moKqMB7Fx5DkUU MKzQcFKsq7HeO+uMDAJiGO7AfSfXfA0i6I/9gtZa2wiqyE3djA1uG6OVjo87Hfgau4bs XUQ2RwDq8Z6/OSVpw/wlQBHFqb/mr+o4imbzgDRvih07VmDLHZdZc7p2vM8BbSYS3M9M WVzOtY6GRFOv18EVk6FklZxBuTYcHB4P9prfEnfhgOmFjqaS+i6RohGo/0ALSRrIxppy 5nfw== X-Gm-Message-State: AKaTC00jQYTqku3qIw+abzuTaRCgCtFl90LyMc6v08pvwX7nhtTWeRnqmLfwnbW2vhNTk7LMASUwYRalVF/K+Q== X-Received: by 10.200.43.167 with SMTP id m36mr3246586qtm.117.1479919168823; Wed, 23 Nov 2016 08:39:28 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <20161123072454.GA4898@solfire> References: <20161123072454.GA4898@solfire> From: Mikael Magnusson Date: Wed, 23 Nov 2016 17:39:28 +0100 Message-ID: Subject: Re: Emulating 'find's print0... To: Meino.Cramer@gmx.de Cc: Zsh Users Content-Type: text/plain; charset=UTF-8 On Wed, Nov 23, 2016 at 8:24 AM, wrote: > Hi, > > 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) ? If you use a reasonable version of xargs, you can specify -d\\n to only split on newlines. (POSIX xargs doesn't have it, but then again, POSIX xargs is almost impossible to use safely). Some examples: % print -l "one line" "another line" | xargs printf %s\\n one line another line % print -l "one'line" "another line" | xargs printf %s\\n xargs: unmatched single quote; by default quotes are special to xargs unless you use the -0 option % print -l "one'line" "another line" | xargs -d\\n printf %s\\n one'line another line -- Mikael Magnusson