Sample Header Ad - 728x90

Capture output of a command that get stuck

2 votes
1 answer
548 views
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?
Asked by dcubaz (23 rep)
Oct 19, 2022, 07:57 PM
Last activity: Oct 19, 2022, 08:59 PM