5
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

head コマンド(Broken pipe エラー)

Last updated at Posted at 2016-02-09

こんにちは。
head コマンドは、長大な標準出力をパイプラインで受け取って使うと、打ち切りを行うので、Broken pipe エラーが起きてエラー出力が目障りかもしれません。

対処方法は、エラー出力を捨てるか、打ち切られてもエラーを出力しないコマンドを挟むかなどがあるようです。

$ 長大な標準出力 2>/dev/null | head
$ 長大な標準出力 | tail -n +1 | head

対処無しですとエラー出力はこのような具合です:

$ 長大な標準出力 | head
  :
  :
Broken pipe - <STDOUT> (Errno::EPIPE)
5
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?