grep and xargs

guys... I wanna use xargs in such a way that i can use it in grepping the fileds..

something like this:

grep -p <xargs values> *

lemme know how to do this..

What -p flag stands for, I can't find this in my version of grep. Can you post a sample or more info on what needs to happen ?

Something like this:

command | xargs -i ksh -c ' grep -p "{}" *'

it worked but the grep command ran for multiple times, ...

grep -p <pattern> <file>

gives the paragraphic view of the <pattern> value in the <file>

Man page info. pasted below:
-p[Separator] Displays the entire paragraph containing matched lines. Paragraphs
are delimited by paragraph separators, as specified by the Separator parameter,
which are patterns in the same form as the search pattern. Lines containing the
paragraph separators are used only as separators; they are never included in the
output. The default paragraph separator is a blank line.

Lemme know if u need any example

xargs can/will do that. Think of running something like 'find . -type f -exec grep foo {}\;' - that will exec 'grep' once for each file found. Now, running 'find . -type f | xargs grep foo' will minimize the number of time grep is called. It still may need to be called more than once, since there is a limit to the length of a command line, depending on your shell and architecture - for example, mine is roughly 32k. If I ran a huge search on a large source branch, I'd expect to search well over 32k files, so even in the best case scenario, xargs could not possibly build the "ideal" command line for me.