Нужна помощь в настройке этой команды jq
для вывода типа json
.
Пример testout.out
:
{ "_id" : ObjectId("5aaaa017e4b09780301b6c18"), "account" : "abc", "profile" : "catch", "settings" : { "region" : "us-east-1" } }
{ "_id" : ObjectId("5ad894fbe4b0657c569ed5d8"), "account" : "def", "profile" : "test", "settings" : { "region" : "eu-central-1" } }
{ "_id" : ObjectId("5ae127dee4b06990170a0eb4"), "account" : "ght", "profile" : "main", "settings" : { "region" : "us-east-1" } }
Я пытаюсь отсортировать по region
.
Попытка этой команды:
cat testout.out | jq -s -c 'sort_by(.region) |.[]'
Получение этого вывода:
parse error: Invalid numeric literal at line 1, column 20
Ожидается сортировка по алфавиту region
:
{ "_id" : ObjectId("5ad894fbe4b0657c569ed5d8"), "account" : "def", "profile" : "test", "settings" : { "region" : "eu-central-1" } }
{ "_id" : ObjectId("5aaaa017e4b09780301b6c18"), "account" : "abc", "profile" : "catch", "settings" : { "region" : "us-east-1" } }
{ "_id" : ObjectId("5ae127dee4b06990170a0eb4"), "account" : "ght", "profile" : "main", "settings" : { "region" : "us-east-1" } }