Suppose I have used awk
to get the value of two different columns:
Say the output is:
abc
def
Now, I want to use both abc
and def
as patterns for grep
, using a pipeline with the previous command. Is there any way to do this?
For more clarification:
I have a pdf file and I am searching for a keyword the file using :
pdftotext 'filename.pdf' - | grep 'pattern'
Now if any match is found, I want to use the first and second column of the result as parameters for grep in pipeline with the previous command. I can get the first two columns using
pdftotext 'filename.pdf' - | grep 'pattern' | awk '{ print $1, "\t"$2 }'
Now how will I pass these two values again (2nd time) as patterns after grep command in pipeline with the above one?