The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 08-11-2007
sudheshnaiyer sudheshnaiyer is offline
Registered User
  
 

Join Date: Aug 2007
Posts: 12
count the number of files which have a search string, but counting the file only once

I need to count the number of files which have a search string, but counting the file only once

if search string is found.

eg: File1: Please note that there are 2 occurances of "aaa"

aaa
bbb
ccc
aaa

File2: Please note that there are 3 occurances of "aaa"

aaa
bbb
ccc
aaa
aaa

File3:
bbb
ccc

But need the count of files which has the occurance of "aaa". In the above example, it should
give me 2 --> (File1 and File2).

It should not give me 5 since "aaa" occured 2 times in File1 and occured 3 times in File2.