I am trying to use regex for capturing some text pattern in an ouput of a command and create an array list_mqs. The problem is that this previous command get stuck and never terminates. So, when I use a pipeline | egrep, never starts the egrep command because the other routine did not finish.
The patterns that I am trying to capture are:
MQ_1A, MQ_F5,MQ_H7.
[user@host] list_mqs=($(command_never_ends | egrep -io "MQ_*"))
Is there any way that I can redirect the output of the previous commands even it never ends(or maybe set a counter and if reached exit), and pass those content to be analyzed by the egrep routine?
command_never_ends? Is it literally? Because if this one never ends then the arraylist_mqsshould not be necessary. Or you are sayingcommand_never_endsbecause this one gets stuck and never pipe the output toegrep?