From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8528 invoked by alias); 24 Apr 2016 11:22:50 -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: 21484 Received: (qmail 9446 invoked from network); 24 Apr 2016 11:22:48 -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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:disposition-notification-to :user-agent; bh=WMx9HUwwBoUrK+W6g+zsMx6tqeGV30qi0wABgdOpXnk=; b=GtKcP3unA3PPGMtdud7O2eSEem1+fU6wqtyTlNAXyzi0C+GTzxbXwKl0fTRr3nHHdx bESiLR2jt5JPvcx5btCVJGaknqqPVtJ/HTLkV5JUDB5FhVak7OaKBtwozwrxEmVWa0bj wMVT452crO5FO/GJIJ4Iu11bX7dZmFi8RKVzRdD6yPT+HSLbKpfTj7vg6tDsPYcLveXb 31C9aaGZgRfVd6anJ3WBqwOl0ry8tlLoZCqPiKWvgX4JqY+MR3QqHorM0iHcXwCeFXMM 9cvvJC5kEfS0En4Sa7IXB9gm8q9BoL6wGmBGO3MHoVsOfvkpBMxJRHGECu8oKSYJRube nV5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:subject:message-id:references :mime-version:content-disposition:in-reply-to :disposition-notification-to:user-agent; bh=WMx9HUwwBoUrK+W6g+zsMx6tqeGV30qi0wABgdOpXnk=; b=g+JiaBd1YYmF8ypy6lpjF4jP2ddJ4/9SGcnbfLZwCH7ro47Uye6IJT8+OljUDM2AA0 WnjD+3eS3S7CDXXAZmIs6pF7NqBnTRhQ879ljFPA9dqpTzJvBErMYMghQwaY21haNp2S nA4pPc3opC5YRObR4qIMPHJFXJxRRUBey96HwW4lXwdnfjFxSDQiahilhbcCWfSYyld5 7U4NxJ8GfS02aFkZ7i4b2BCcGUPkvLbtqxr3Tgy8xEdK3yyu7ANGKhbxDh5ZXyDFd2qc Wxlefa8kq/PmZzzQt5jpNAZg2wv4uRElMmLFXghLocudku6VHr5dz8u/2B7mV2Hq6k5O uKZw== X-Gm-Message-State: AOPr4FUHPWiyLswjaL8qGbSAMqqeY+aRosW9rHFFhqe1i55UnbECR0Xh8vw+AyOWMdh4CA== X-Received: by 10.66.194.230 with SMTP id hz6mr41583363pac.132.1461496966605; Sun, 24 Apr 2016 04:22:46 -0700 (PDT) Date: Sun, 24 Apr 2016 19:22:09 +0800 From: lilydjwg To: zsh-users@zsh.org Subject: Re: I/O edirection and dd Message-ID: <20160424112209.GA20670@lilyforest.localdomain> References: <20160424095342.GA11812@solfire> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160424095342.GA11812@solfire> User-Agent: Mutt/1.6.0 (2016-04-01) On Sun, Apr 24, 2016 at 11:53:42AM +0200, Meino.Cramer@gmx.de wrote: > Hi, > > with the pipe > > cat verylongfile | dd count=512 | file - > > I want to get the type of file without reading it completly. > > Unfortunately dd and cat are very chatty and print something like: > > 512+0 records in > 512+0 records out > 262144 bytes (262 kB) copied, 0.00396828 s, 66.1 MB/s > "Here comes the wanted output of the file command' > [2] 32419 broken pipe cat tmp.blend | > 32420 done dd count=512 | > 32421 done file - > > > I want to get rid of all that - except for the printout of the > 'file' command. > > I tried several permutations and combinations of '{}", "2>&1" and > such but beside some additional syntax errors my success was very > ....hrmmm....limited. > > How can I acchieve what I want? > > Thank you very much in advance for any help! Why don't you let file read the file itself? file won't read the entire file. dd prints out information to stderr, so you can do cat verylongfile | dd count=512 2>/dev/null | file - cat isn't necessary in this case. You can just use redirection: < verylongfile dd count=512 2>/dev/null | file - And head -c256k will do the same as your dd command. -- Best regards, lilydjwg