请尝试以下操作:
grep -o "string" filename | wc -w
Run Code Online (Sandbox Code Playgroud)
如果您想要目录中的所有文件,请从该目录运行以下脚本:
for file in *
do let count=$count+`grep -o "wordyouaretryingtofind" $file | wc -w`
done
echo occurence $count times
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
145 次 |
| 最近记录: |