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.
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
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
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
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
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
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
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
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
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
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
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
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
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-
% 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
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
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
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
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
19 matches
Mail list logo