I'm trying to create a for loop that counts the number of keywords in each file within a directory separately.
For Example if a directory has 2 files I would like the for loop to say
foo.txt = found 4 keywords
bar.txt = found 3 keywords
So far I have written the below but its give the total number keywords from all files instead of for each separate file.
The result I get is
7 keywords founds
Instead of the desired output above
Here is what I came up with
for i in *; do egrep 'The version is out of date|Fixed in|Identified the following' /path/to/directory* | wc -l ; done