AWK Print $2 Breaking Bash Args -


i'm trying capture output ec2 command awk. awk portion works , ec2 command work. problem is, pass arguments script , 1 of them conflicts style of awk. print $2

proper segment

cmd="/opt/aws/bin/ec2-run-instances -o $secid  -w $seckey $ami  -n $1 -g $secg -k $sshkey -t $instsize -z $2 | awk '/^instance/ {print $2}' 

as can see, need print $2 capture ec2 instance id. there workaround without changing arg format?

thanks!

reservation     r-******      ********    www.abc.com instance        i-****      ami-***** 

result=$(/opt/aws/bin/ec2-run-instances -o $secid  -w $seckey $ami  -n $1 -g $secg -k $sshkey -t $instsize -z $2 | awk '/^instance/ {print $2}') instance_id in $result; echo $instance_id; done 

Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -