LoginSignup
0
0

More than 5 years have passed since last update.

grepの組み合わせメモ

Posted at

grepを使ったコマンドを忘れるので覚書。

■~以外のファイルを削除したい場合のコマンド

Shell_script.コマンド
 ls | grep -v -E '削除したくないファイル名$' | xargs rm -r

■特定のファイルから特定の文字列を検索したい場合のコマンド

Shell_script.コマンド
find . -name "*.php" | xargs grep 検索文字

■特定の文字列をカウントしたい場合のコマンド

Shell_script.コマンド
grep -c "検索文字列"

#出力
11
0
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
0
0