Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
以下のコマンドを使用すると、現在のディレクトリで指定された文字列が出現する総数を見つけることができました。
cat * | grep -c 'nike'
同様に、指定されたキーワードが少なくとも 1 回出現するファイルの総数を取得する方法は?
本当にありがとう
grep -l はファイル名のみを出力します
grep -l 'nike' * | wc -l
grep -l ナイキ * | トイレ -l
猫は使いません。
wcでgrepを使用し、-lオプションは行用です。
grep -R "パターン" .|wc -l