I've run into a problem getting exactly what I want out of awk - some folks may recognize this as an output from Amazon's ec2-describe-instances:
Given the following:
INSTANCE i-4960f321
BLOCKDEVICE Line2Var2
TAG instance i-4960f321 Name web1
TAG instance i-4960f321 aws:autoscaling:groupName web1asg
INSTANCE i-4960f322
BLOCKDEVICE Line6Var2
TAG instance i-4960f322 Name web2
TAG instance i-4960f322 aws:autoscaling:groupName web2asg
INSTANCE i-4960f320
BLOCKDEVICE Line10Var2
TAG instance i-4960f320 Name app1
The desired output is:
$2 (from the INSTANCE line), $5 (from the first TAG line) or NULL, $5 (from the second TAG line) or NULL.
Example:
i-4960f321 web1 web1asg
i-4960f322 web2 web2asg
i-4960f320 app1 NULL
CJ
P.S. If folks are interested, if I find something helpful here I'm planning on using for a suite of Amazon Web Service related tools called aws missing tools (Google for it - fourth link).