【发布时间】:2018-10-04 15:53:21
【问题描述】:
我正在尝试创建一个 for 循环,该循环分别计算目录中每个文件中的关键字数。
例如,如果一个目录有 2 个文件,我希望 for 循环说
foo.txt = found 4 keywords
bar.txt = found 3 keywords
到目前为止,我已经编写了以下内容,但它给出了所有文件中的关键字总数,而不是每个单独文件的关键字。
我得到的结果是
7 keywords founds
而不是上面想要的输出
这是我想出来的
for i in *; do egrep 'The version is out of date|Fixed in|Identified the following' /path/to/directory* | wc -l ; done
【问题讨论】: