From: lilydjwg <lilydjwg@gmail.com>
To: zsh-users@zsh.org
Subject: Re: I/O edirection and dd
Date: Sun, 24 Apr 2016 19:22:09 +0800 [thread overview]
Message-ID: <20160424112209.GA20670@lilyforest.localdomain> (raw)
In-Reply-To: <20160424095342.GA11812@solfire>
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
next prev parent reply other threads:[~2016-04-24 11:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-24 9:53 Meino.Cramer
2016-04-24 11:22 ` guyzmo
2016-04-24 11:22 ` lilydjwg [this message]
2016-04-24 17:10 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160424112209.GA20670@lilyforest.localdomain \
--to=lilydjwg@gmail.com \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).