0

hi i got bash file like this

#!/bin/bash
for y in $(aws resourcegroupstaggingapi get-resources --resource-type-filters eks --query "ResourceTagMappingList[*].{Project:Tags[?Key=='Name']|[0].Value,Project:Tags[?Key=='Project']|[0].Value}" --output text )
do
echo "$y" 
done

the real output if not use bash and for is

$aws resourcegroupstaggingapi get-resources --resource-type-filters eks --query "ResourceTagMappingList[*].{Project:Tags[?Key=='Name']|[0].Value,Project:Tags[?Key=='Project']|[0].Value}" --output text
Backend API
Test APi

but the output from bash file like this

Backend
API
Test
API

i need help to make output like this

Backend API
Test API

i try using sed and paste but not work please help me

  • Sorry I couldn't find a better duplicate. This is a common FAQ; see [don't read lines with `for`](http://mywiki.wooledge.org/DontReadLinesWithFor) – tripleee Mar 30 '22 at 09:19
  • 1
    Your loop iterates over the **words** resulting from the `aws` command, not over the lines. – user1934428 Mar 30 '22 at 11:08

0 Answers0