![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Counting the number of occurances of all characters (a-z) in a string | rsendhilmani | Shell Programming and Scripting | 5 | 08-05-2008 09:10 AM |
| problem with grep on search string in a txt file over multiple files | m00 | UNIX for Dummies Questions & Answers | 2 | 05-18-2008 11:21 AM |
| how to search string and number in one file and check in the other file | knshree | Shell Programming and Scripting | 9 | 08-24-2007 01:29 AM |
| Counting number of files in a directory | iamalex | UNIX for Dummies Questions & Answers | 2 | 09-05-2005 07:13 AM |
| Count number of files in subdirectories | cbeverly | UNIX for Dummies Questions & Answers | 2 | 06-02-2005 12:06 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
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. |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Code:
egrep -l aaa file1 file2 file 3 | wc -l |
||||
| Google The UNIX and Linux Forums |