I have a JSON file that has this content:
{
"Message": {
"greeting": "hello"
}
}
{
"Message": {
"greeting": "Bonjour"
}
}
{
"Message": {
"greeting": "Konnichiwa"
}
}
I would like to extract only the first Message that has "greeting" : "hello".
I can't seem to use an index on it using
cat "$file" | jq -c "."
The above command all returns the three messages. I would like to ask on how to only extract the first message or one by one.
sed '/^}/q' < thatfilewhich would save having to read it fully or parse the json in there.