I would like to take each line of the output of one gcloud command for use in another gcloud command.
gcloud container clusters list |grep jesse (alias gccl)
output:
jesse-gke1 us-eastx-x
jesse-gke2 us-eastx-x
I need both of these variables (name and region) in the next command.
But when I try to use awk to get the variables I need for the next command, it combines both results into a single variable with 2 lines.
cluster=$(gccl 2>/dev/null|grep jesse|awk '{print $1}') ; echo $cluster
Outputs:
jesse-gke1
jesse-gke2
How can I get both of the output items in a command that would look like:
gcloud someaction $1jesse-gke1 $2zone=us-eastx-x
and iterate through the results?
Thanks!