Re: Grepping a list of words

2010-08-18 Thread gs_stol...@juno.com
If I remember correctly, grep (and all its associated versions) accept -v as an option which reports the entries in the list that don't match. Using gref (which is given the name[s] of files) uses those files as a list of the patterns to match.

Re: Grepping a list of words

2010-08-14 Thread Robert Bonomi
From owner-freebsd-questi...@freebsd.org Thu Aug 12 05:36:27 2010 Date: Wed, 11 Aug 2010 18:00:22 -0500 To: freebsd-questions@freebsd.org From: Jack L. Stone ja...@sage-american.com Subject: Grepping a list of words Kindly appreciate help with how to grep (or similar) a list of words

Re: Grepping a list of words

2010-08-13 Thread Jack L. Stone
At 10:56 AM 8.12.2010 -0700, Chip Camden wrote: Quoth Anonymous on Thursday, 12 August 2010: Oliver Fromme o...@lurza.secnetix.de writes: John Levine jo...@iecc.com wrote: % egrep 'word1|word2|word3|...|wordn' filename.txt Thanks for the replies. This suggestion won't do the

Re: Grepping a list of words

2010-08-13 Thread Jonathan McKeown
On Friday 13 August 2010 15:47:38 Jack L. Stone wrote: The only thing it didn't do for me was the next step. My final objective was to really determine the words in the word.file that were not in the main.file. I figured finding matches would be easy and then could then run a sort|uniq

Re: Grepping a list of words

2010-08-13 Thread Jack L. Stone
At 04:01 PM 8.13.2010 +0200, Jonathan McKeown wrote: On Friday 13 August 2010 15:47:38 Jack L. Stone wrote: The only thing it didn't do for me was the next step. My final objective was to really determine the words in the word.file that were not in the main.file. I figured finding matches

Re: Grepping a list of words

2010-08-13 Thread John Levine
Since I will have a need to run this check frequently, any suggestions for a better approach are welcome. sort -u and comm(1)? sort is O(N log N) while grep is O(N) Which is faster depends on the constant factors in each, but as the data sets get bigger, the log N term will dominate. That

Grepping a list of words

2010-08-12 Thread Jack L. Stone
Kindly appreciate help with how to grep (or similar) a list of words to determine if any of them are in a file rather than grepping one word at a time. Thanks for any suggestions... All the best, Jack (^_^) Happy trails, Jack L. Stone System Admin Sage-american

Re: Grepping a list of words

2010-08-12 Thread Daniel Bye
On Wed, Aug 11, 2010 at 06:00:22PM -0500, Jack L. Stone wrote: Kindly appreciate help with how to grep (or similar) a list of words to determine if any of them are in a file rather than grepping one word at a time. Something like this should do the trick: egrep (word1|word2|word3) file Dan

Re: Grepping a list of words

2010-08-12 Thread Thomas Dickey
On Wed, Aug 11, 2010 at 06:00:22PM -0500, Jack L. Stone wrote: Kindly appreciate help with how to grep (or similar) a list of words to determine if any of them are in a file rather than grepping one word at a time. put the list in a file, and use grep -f better, use the \ and \ markers on the

Re: Grepping a list of words

2010-08-12 Thread Anonymous
Jack L. Stone ja...@sage-american.com writes: Kindly appreciate help with how to grep (or similar) a list of words to determine if any of them are in a file rather than grepping one word at a time. Perhaps, `-e' option? $ printf 'foo\nbar\n' | fgrep -e foo -e bar foo bar

Re: Grepping a list of words

2010-08-12 Thread Rodrigo Gonzalez
On Wed, 11 Aug 2010 18:00:22 -0500 Jack L. Stone ja...@sage-american.com wrote: Kindly appreciate help with how to grep (or similar) a list of words to determine if any of them are in a file rather than grepping one word at a time. Use egrep egrep (word1|word2) file signature.asc

Re: Grepping a list of words

2010-08-12 Thread Arthur Chance
On 08/12/10 00:00, Jack L. Stone wrote: Kindly appreciate help with how to grep (or similar) a list of words to determine if any of them are in a file rather than grepping one word at a time. fgrep, aka grep -F A snippet from man grep: -F, --fixed-strings Interpret

Re: Grepping a list of words

2010-08-12 Thread Ashish SHUKLA
Jack L Stone writes: Kindly appreciate help with how to grep (or similar) a list of words to determine if any of them are in a file rather than grepping one word at a time. #v+ % egrep 'word1|word2|word3|...|wordn' filename.txt #v- 'word1|word2|word3|...|wordn' is the regular expression, so

Re: Grepping a list of words

2010-08-12 Thread Jack L. Stone
At 05:14 PM 8.12.2010 +0530, Ashish SHUKLA wrote: Jack L Stone writes: Kindly appreciate help with how to grep (or similar) a list of words to determine if any of them are in a file rather than grepping one word at a time. #v+ % egrep 'word1|word2|word3|...|wordn' filename.txt #v-

Re: Grepping a list of words

2010-08-12 Thread John Levine
% egrep 'word1|word2|word3|...|wordn' filename.txt Thanks for the replies. This suggestion won't do the job as the list of words is very long, maybe 50-60. This is why I asked how to place them all in a file. One reply dealt with using a file with egrep. I'll try that. Gee, 50 words, that's

Re: Grepping a list of words

2010-08-12 Thread Oliver Fromme
John Levine jo...@iecc.com wrote: % egrep 'word1|word2|word3|...|wordn' filename.txt Thanks for the replies. This suggestion won't do the job as the list of words is very long, maybe 50-60. This is why I asked how to place them all in a file. One reply dealt with using a file with

Re: Grepping a list of words

2010-08-12 Thread Anonymous
Oliver Fromme o...@lurza.secnetix.de writes: John Levine jo...@iecc.com wrote: % egrep 'word1|word2|word3|...|wordn' filename.txt Thanks for the replies. This suggestion won't do the job as the list of words is very long, maybe 50-60. This is why I asked how to place them all

Re: Grepping a list of words

2010-08-12 Thread Chip Camden
Quoth Anonymous on Thursday, 12 August 2010: Oliver Fromme o...@lurza.secnetix.de writes: John Levine jo...@iecc.com wrote: % egrep 'word1|word2|word3|...|wordn' filename.txt Thanks for the replies. This suggestion won't do the job as the list of words is very long, maybe

Re: Grepping a list of words

2010-08-12 Thread John R. Levine
Gee, 50 words, that's about a 300 character pattern, that's not a problem for any shell or version of grep I know. But reading the words from a file is equivalent and as you note most likely easier to do. The question is what is more efficient. This might be important if that kind of grep