I need help with pattern matching. I have the following text as the output of a command.
j-13PUDS1BDAAKK RUNNING ec2-54-242-150-167.compute-1.amazonaws.com Log Processing Job Flow
COMPLETED Setup Hive
RUNNING CopyLogs
PENDING CopyLogs
PENDING CopyLogs
PENDING CopyLogs
I need to match the CopyLogs output to Completed. So basically after the execution of the command the output should be
COMPLETED CopyLogs
COMPLETED CopyLogs
COMPLETED CopyLogs
COMPLETED CopyLogs
How do I do that in a do while loop (for a retry logic). I tried the following
while :; do
result=$(elastic-mapreduce --jobflow $JOBFLOW --list) //lets say this returns the above output
[[ $result == +(*RUNNING*|*PENDING*|*WAITING*) ]] || break
done
echo "result now has no RUNNING or PENDING or WAITING"
but I just need to do this for "CopyLogs". How do I achieve that