LoginSignup
1
0

More than 5 years have passed since last update.

指定文字が含まれていないファイルを一覧で表示する。

Posted at

概要

指定文字が含まれていないファイルを一覧で表示したいことがたまにあるが、いつもコマンドを忘れるのでメモ。
※指定文字が含まれているファイルを一覧で表示するコマンドもついでにメモ。

手順

文字列「aaaa」を含まないhtmlファイルをディレクトリ「testdir」内から検索して一覧表示する。

grep -Lir 'aaaaa' testdir --include='*.html’

※コマンドのフォーマット
grepコマンド/オプション/‘検索文字’/検索対象ディレクトリ/--include=‘*.検索対象拡張子’

文字列「aaaa」を含むhtmlファイルをディレクトリ「testdir」内から検索して一覧表示する。

grep -ril 'aaaaa' testdir --include='*.html’
1
0
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
1
0