------------------------------------ aws cli bits ----------------------------------------
aws ec2 describe-instances --output text --filters "Name=instance-state-name,Values=running" --query 'Reservations[*].Instances[*].[InstanceId,Tags[?Key==`Name`].Value[]]' | sed '$!N;s/\n/ /'
#### getting three columns (just for testing)
aws ec2 describe-instances --output text --filters "Name=instance-state-name,Values=running" --query 'Reservations[*].Instances[*].[InstanceId,Tags[?Key==`Name`].Value[]]' | sed '$!N;s/\n/ /; $!N;s/\n/ /'
#### $!N means read in the next line only if it is not the last line in the file. If it would try to read in the line after the last line some versions of sed simply quit without doing anything. That's why you should use $!.
#### http://askubuntu.com/questions/461191/what-is-the-meaning-of-an-in-a-sed-command