LoginSignup
72

More than 5 years have passed since last update.

gzのファイルを展開せずにgrepする

Posted at

ログファイルをgrepして何かを集計する場合があると思いますが、webアプリログとかはファイルサイズも大きく、月ごとにtar.gzになってたり、日ごとにgzになってる場合が多いと思います。

一回展開してからgrepをかけたりしてるとファイルサイズがでかいのでちょっとやっかいだったりするんです。

今回は日ごとにgzされているファイルを展開せずにgrepする方法。

zgrep "aaa" hoge.log.gz

以上です。
ぇ…grepコマンドの前にzつけるだけです。。。

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
72