Quantcast
Channel: Active questions tagged jq - Stack Overflow
Viewing all articles
Browse latest Browse all 657

jq - print newlines while processing rows from an array

$
0
0

Suppose I have a json like this:

{"records": [    {"id": 1,"name": "hello"    },    {"id": 2,"name": "world"        }  ]}

I could do this:

$ jq -r '.records[] | "id: \(.id) name: \(.name)"' afile.jsonid: 1 name: helloid: 2 name: world

How can I insert new lines so that I could get this:

id: 1name: helloid: 2name: world

Viewing all articles
Browse latest Browse all 657

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>