Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 04-06-2004, 05:28 AM   #1
LQ Newbie
Registered: Mar 2004
Location: Afghanistan
Distribution: Red Hat Linux 9.0
Posts: 4

Rep: Reputation: 0
Exclamation 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.
Old 04-06-2004, 11:18 AM   #2
Senior Member
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,530

Rep: Reputation: 110Reputation: 110
Try: cat <pattern file> | global -xg -


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
selecting patterns in file manjushp Programming 15 09-10-2005 08:43 AM
Remembering patterns and printing only those patterns using sed bernie82 Programming 5 05-26-2005 05:18 PM
File Searching gfrair Linux - Newbie 1 03-14-2005 06:24 PM
File Searching JC404 Linux - Newbie 2 08-02-2003 08:45 PM
searching through a file albean Linux - Newbie 8 11-23-2002 08:16 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:18 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration