1
0

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.

よく自分が使うgrepコマンド

Posted at

自分がよく使うgrpeのやりかた。
忘れはしないだろうけど、一応自分用にメモとして残しておく。
(最近、自分の記憶力を信用していない)

# "hogehoge"という単語を、カレント直下のディレクトリを再帰的にたどって検索。なお、node_modulesとdistディレクトリは除外。
grep -inr hogehoge ./ --exclude-dir={node_modules,dist}

--exclude-dirで除外ディレクトリを設定できるが、
最初はまったのは、--exclude-dir={node_modules, dist}というようにスペースが入っていると、私の環境(zsh)の場合エラーになるということ。

zsh: parse error near `}'

最初、何が原因でエラーになっているのかがよく分からなかった。
意外とネットで調べてみてもすぐに答えが見つからなかったので、こういうのって常識中の常識なのかも知れない。
探し方が悪かった可能性は否定しない。
(よって、30分ほど答えが見つからないまま悩んでいた。。)

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?