From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11520 invoked by alias); 24 Apr 2016 11:32:19 -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: 21485 Received: (qmail 14752 invoked from network); 24 Apr 2016 11:32:17 -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,T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.1 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=m0g.net; s=mail; t=1461496936; bh=PponNXuZ1P6KKUjkjkpETRp8nUGEq8DKT9Vmi7uHXx4=; h=Date:From:To:Subject:References:In-Reply-To:From; b=ehIBTYxBnvfF4DNbrdfGGOEYcuaFFAlwFukCWtaOOs8Ayxy8XhOfAffiX2Suq1ABd BXTjR1or0VCB780jlDFCPDuC30Bv6V6tQVK4fM4a2BUfS1sey1jvWrOSNLajDi/6dQ w5SlXS9ej5dHFlOWosr4FNPxZCY3+00AL8bLD+/1p8NsP3H39v5GUZbICKngzOod0E J2NZ84vUe1xFopVWVk4ybrvQOGV8N+bS5wQBTDo31PZ/uxplNYxbK1jT8fF27zwBNc Dxk8zx5HTVd2o77jNh1GuMJTh/9mGVJ/HZnCoFeDoWFckjmAONpSCw28QoB5h4SPfc Yj4MMm7hiW4Sw== Date: Sun, 24 Apr 2016 13:22:02 +0200 From: guyzmo To: zsh-users@zsh.org Subject: Re: I/O edirection and dd Message-ID: <20160424112202.fre5vs6axp5grofy@BuGz> References: <20160424095342.GA11812@solfire> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160424095342.GA11812@solfire> Hello Meino, this question is not diretcly zsh related so this list is not the place to ask that. It would be a better fit for a stackexchange-like forum (either stackoverflow, or superuser, or unix stackoverflow). But anyway, I'm giving you an answer inline. On Sun, Apr 24, 2016 at 11:53:42AM +0200, Meino.Cramer@gmx.de wrote: > with the pipe > > cat verylongfile | dd count=512 | file - > > I want to get the type of file without reading it completly. [...] > How can I acchieve what I want? First, you're doing a useless use of cat, as dd can have its input file defined using the 'if=' argument. Then the byte count is way too high, as file only needs the first few bytes to determine type of a file. Finally, you can get rid of useless output by redirecting stderr from dd into the null chadev, but if you don't it's not preventing file to do its job. So here you go: % dd if=ascii_file.txt count=10 | file - 10+0 records in 10+0 records out 5120 bytes (5.1 kB) copied, 6.7592e-05 s, 75.7 MB/s /dev/stdin: ASCII text or for the less chatty version: % dd if=ascii_file.txt count=10 2> /dev/null | file - /dev/stdin: ASCII text and there you go! HTH, -- Guyzmo