Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: I/O edirection and dd
- X-seq: zsh-users 21484
- From: lilydjwg <lilydjwg@xxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: I/O edirection and dd
- Date: Sun, 24 Apr 2016 19:22:09 +0800
- Disposition-notification-to: lilydjwg@xxxxxxxxx
- 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==
- In-reply-to: <20160424095342.GA11812@solfire>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <20160424095342.GA11812@solfire>
On Sun, Apr 24, 2016 at 11:53:42AM +0200, Meino.Cramer@xxxxxx 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author