![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | 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 !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| help for search or grep in a file | pvr_satya | Shell Programming and Scripting | 2 | 08-04-2008 03:04 PM |
| how to search -n in a file with grep | lamilami | Shell Programming and Scripting | 2 | 11-28-2007 04:42 PM |
| recrusive search in GREP | arunkumar_mca | UNIX for Dummies Questions & Answers | 8 | 11-16-2006 09:49 PM |
| multiple search with grep | amon | Shell Programming and Scripting | 5 | 04-04-2006 07:53 AM |
| grep - speed of search | davirime | UNIX for Dummies Questions & Answers | 1 | 09-25-2002 10:26 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Distinct search usisng GREP cmd
Hi All,
I have the following problem where I have been trying but not able to resolve it:- I have a file which has some thousands entries. For eg:- The content of the file is :- ============================================== ./admin.cpp:9:#include "framework/RegistryContext.h" ./admin.cpp:10:#include "framework/LoggingContext.h" ./adminbatchbase.h:10:#include"framework/RegistryInterface.h" ./adminbatchbase.h:11:#include"framework/LoggingInterface.h" ./adminbatchbase.h:12:#include"framework/BatchException.h" =============================================== Now if I count the number of occurences of "framework" then it comes to 5(wc -l) But I want the count to be 2 as there are only 2 distinct files where framework is there. Could somebdy help me with this? Thanks, SD. |
|
||||
|
Sorry....The below code will not work as per the requirement
Try using -w option with grep. If you want the search to be extended in multiple files, try the following command find . 2>/dev/null | xargs grep -w "string" 2>/dev/null Last edited by sriharsha_kvr; 11-14-2008 at 05:27 AM.. Reason: Requirement wrongly understood |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|