2
2

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.

Windows の ping.exe は、なぜか改行の出力が CR + CR + LF になっている

Posted at

コマンドプロンプト上で実行していると気づかないが、出力をファイルにリダイレクトすると分かる。

このため、PowerShell で次のようにして ping 出力をファイルに残そうとすると、画面出力もファイル出力も、余計な空行が入って残念な感じになる。
(PowerShell の場合、CR + CR + LF を CR + LF + CR + LF に修正するようだが、空行が入るのは同じ)

ping -t <IPアドレス> | tee ping.log

これを回避するには、空行を除去してパイプに渡してやればよい。

ping -t <IPアドレス> | Select-String -Pattern "\S" | tee ping.log
2
2
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
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?