Issue
How can I show the count of a grep per file when searching in various files at once via regex
grep -c -? somestring log*
so, if I have n files log_1, log_2, log_3, .., log_n and I grep -c for somestring, then I would like the output to be
log_1 'result of grep -c in file log_1'
log_2 'result of grep -c in file log_2'
Can I do this with a grep command or do I have to construct some sort of loop?
Solution
From almas shaik. works great
grep -cH <searchString> <files>
Answered By - chrise Answer Checked By - Marilyn (WPSolving Volunteer)