grep -v \<Swap instruments.log | awk '{ idx=index($0, MasterId=); masterId=substr($0, idx+length(MasterId=)+1); masterId=substr(masterId,1,index(masterId,L)-3); print masterId; }' | xargs grep rel.logI need to search each of that MasterId/output of awk in rel.log using xargs or something.How can I do that? 
xargs grep suggestion
grep;awk;xargs
Use while with read to get a line at a time from the pipe, and feed that to grep.grep -v \<Swap instruments.log | \  awk '{ idx=index($0, MasterId=);    masterId=substr($0, idx+length(MasterId=)+1);    masterId=substr(masterId,1,index(masterId,L)-3);    print masterId; }' |\  while read line; do    grep -- $line rel.log  done