如何计算文本文件中以某个单词开头的行数?
我不想使用sed进而wc -l。有更好的解决办法吗?
sed
wc -l
只需 grep 你的单词,然后使用 wc -l 来计算行数......就像这样 grep '^your_word' /path/to/file | wc -l
grep '^your_word' /path/to/file | wc -l