Find words in many files

Posted by ant2009 on Super User See other posts from Super User or by ant2009
Published on 2010-04-23T05:22:35Z Indexed on 2010/04/23 5:24 UTC
Read the original article Hit count: 264

Filed under:

Hello,

I am looking for this struct messages_sdd_t and I need to search through a lot of *.c files to find it. However, I can't seen to find a match as I want to exclude all the words 'struct' and 'messages_sdd_t'. As I want to search on this only 'struct messages_sdd_t' The reason for this is, as struct is used many times and I keep getting pages or search results.

I have been doing this without success:

find . -type f -name '*.c' | xargs grep 'struct messages_sdd_t'

and this

find . -type f -name '*.c' | xargs egrep -w 'struct|messages_sdd_t'

Many thanks for any suggestions,

© Super User or respective owner

Related posts about linux