Unanswered: problem in pattern matching in shell script
need some help regarding shell scripts...
what i'm doing is finding the occurence of a string in a directory(recursively)
to get the count of files..i'm giving
count="`grep -r "$string" * | wc -l`"
and for getting the file names i'm giving
for file in "`grep -irn "$string" *`"
I just want to ask can i get the count as well as the file names in one command .so that i don't have to use grep twice and get both the variables(count & filename).
And one more thing..i want to find a string like
"function(" not like ".function(" .
eg. if i have 2 lines
So after grep it should return me only the second line.
How should i go 'bout it??