LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Searching patterns from file (http://www.linuxquestions.org/questions/programming-9/searching-patterns-from-file-166773/)

MichaelVaughn 04-06-2004 06:28 AM

Searching patterns from file
 
I am trying to analyze a source code package, and I am trying to find occurences of expression patterns e.g 'waitpid' in the entire source package. The pattern is not only a single expression but a large set of expressions, and naturally I have to store the list of patterns in the file.
The pattern file contains 100's of pattern expressions, one expression per line. I tried to use grep to find the pattern, but ,this was not effective. The output is nonsense.

grep -rn -f <pattern file> ./

There is an open source tool GNU Global, it generates html tags for an entire source package , and allows you to search for expressions from source files.
To search an occurence of the expression, the syntax is

global -xg 'pattern expression'

But the problem is that it supports only searching a single pattern.
I tried this trick

global -xg `cat <pattern file>`

But apparently dumping from cat is only effective if the pattern file contains only several lines of words. But for 100's of lines. This will not work!!! There is no output.
You could try this.

I really need help... This is urgent.

Hko 04-06-2004 12:18 PM

Try: cat <pattern file> | global -xg -


All times are GMT -5. The time now is 11:33 AM.