How to take the result of awk as the pattern parameter of grep?

for example

grep 20180906834424 test.log | awk "{print $2}" 

the above code will produce a result. How can I use this result as a parameter of grep to re-search the test.log file?

grep 20180906834424 test.log | awk "{print $2}"  | xargs grep PATTERN test.log

result, the result of awk is always used as the file name. How can it be regarded as PATTERN?

May.27,2021

xargs-I {} will build the command line into an execution process similar to a for loop. Consider using splicing pattern to speed up the execution process, only grep once.

 

use the option-I of xargs to indicate which parameter bit of the subsequent command you want to populate the contents of the pipe to.

grep 20180906834424 test.log | awk'{print $2}'| xargs-I {} grep {} test.log

should be a

that can meet your needs.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b38ae8-2c13a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b38ae8-2c13a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?