-3

jq 总是在每个字段之间产生带有换行符/返回的输出:

jq ... foo.json
{
  "Name": "stedolan",
  "RecordTimestamp": "2021-02-25T05:00:06.740+0000"
}

如何使每条记录输出一行,使其看起来像:

{"Name":"stedolan","RecordTimestamp":"2021-02-25T05:00:06.740+0000"}
4

1 回答 1

0

jq 有一个选项:--compact-output

jq --compact-output ... foo.json
{"Name":"stedolan","RecordTimestamp":"2021-02-25T05:00:06.740+0000"}

完整手册https://stedolan.github.io/jq/manual/v1.6/

于 2021-02-25T23:26:22.433 回答