Grep is my enemy...
Stephen Allen
freebsduk at rowyerboat.com
Wed Oct 4 01:52:12 BST 2006
Yes, this old chestnut again... sorry!
I have a pattern file with keywords/phrases, 1 per line, and now and
there there are blank lines scattered through the file.
I want to filter the patterns on the fly (getting rid of the blank
lines), and using the result as the pattern file for grep -f.
I also want to supply a string for the grep data, not a file. So my
command looks something like this:
grep -i -v '^[ ]*$' <pattern_file> | grep -f <stdin> <string>
Obviously, grep doesn't like the <string> part and complains bitterly
that it can't find the file.
Can this be done in one statement? I'd like to keep it on one statement
because it will be part of a procmail recipe, and I don't want to keep
writing temporary files to disk.
Many thanks (and sorry for being a PITA over grep)
Steve :)
More information about the Ukfreebsd
mailing list