Results 1 to 6 of 6
I want to search files (basically .cc files) in /xx folder and subfolders.
Those files (*.cc files) must contain #include "header.h" AND x() function.
Clearly,
I wanna list of *.cc ...
- 12-17-2010 #1Just Joined!
- Join Date
- Dec 2010
- Posts
- 3
how to grep?
I want to search files (basically .cc files) in /xx folder and subfolders.
Those files (*.cc files) must contain #include "header.h" AND x() function.
Clearly,
I wanna list of *.cc files that have 'header.h' & 'x()'. They must have two strings.
I tried several ways, and got only files with header.h OR x().
Some examples given in Internet doesn't give any result in my system.
I am using Fedora 8.0 in my PC and I have grep 2.5.1 version.
- 12-17-2010 #2Linux Newbie
- Join Date
- Apr 2007
- Posts
- 119
- 12-17-2010 #3
To make it even saver, use the -Z parameter for grep and the -0 parameter for xargs. That will separate the different file names with NULL bytes instead of newlines.
Refining Linux Advent calendar: “24 Outstanding ZSH Gems”
- 12-19-2010 #4Just Joined!
- Join Date
- Dec 2010
- Posts
- 16
grep [hH]ello
is the same as
grep "[hH]hello"
and this always confused me...
- 12-19-2010 #5
That's clear, since it's a character class.
But what does this have to do with the topic?Refining Linux Advent calendar: “24 Outstanding ZSH Gems”
- 12-21-2010 #6Just Joined!
- Join Date
- Dec 2010
- Location
- India
- Posts
- 45
grep -iR "x()" `grep -iR "header.h" *.cc | cut -f1 -d:` | cut -f1 -d:
output will be the file containing both "header.h" and "x()"


Reply With Quote
