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

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -