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.
大文字で始まるファイル内の行数をすばやく確認するにはどうすればよいですか?
正規表現を使用すると、これは [AZ]*) になると思いますが、「行を読む」ことはしたくありません...もっと高速です。
readループを使用したくない場合の最良のオプションは、次のように、一致する行をカウントgrepする-cスイッチを使用することです。
read
grep
-c
grep -c ^[A-Z] the_file.txt