I'm trying to grep lines from a execution output with a multi-line shell variable, but I'm not quite sure how to do it for example, if I execute a file named run and the result is:
blahblah aaa
blahblah bbb
blabhblasd ccc
----------- ddd
...
blah blah ggg
and so on. And then, I have a shell variable, which is a another result from grep (and is multiline), for example $VAR holds
aaa
bbb
ggg
I want to grep this $VAR from the result of run, so I have the result
blahblah aaa
blahblah bbb
blah blah ggg
I tried something like
run | grep "VAR" but I'm not quite getting the result I want. Is there any way to grep multi-line variable from a execution output?