big acme.jsonの証明書のみを削除する

big acme.jsonの証明書のみを削除する

大容量のjsonファイルをフォーマットし、次の形式の証明書のみを削除する方法を見つけようとしています。

{
  "http-01": {
    "Account": {
      "Email": "[email protected]",
      "Registration": {
        "body": {
          "status": "valid",
          "contact": [
            "mailto:[email protected]"
          ]
        },
        "uri": "https://acme-v02.api.letsencrypt.org/acme/acct/110801506"
      },
      "PrivateKey": "long_key_string",
      "KeyType": "4096"
    },
    "Certificates": [
      {
        "domain": {
          "main": "domain.tld"
        },
        "certificate": "long_cert_string",
        "key": "long_key_String",
        "Store": "default"
      },
      {
        "domain": {
          "main": "domain2.tld"
        },
      .....

私は試してみましたがcat acme.json |grep certificate | awk ' { print $1 $2 } '、テキストのみを選択し"certificate":てコンマ間の証明書を編集するのに苦労しています。

bash / pythonを使用してフォーマットするエレガントな方法はありますか?方法が見つかりません。

ベストアンサー1

jqとそのマニュアルページを確認してください。始めるのに役立つ内容があります!

jq '."http-01"."Certificates"[]."certificate"="OMITTED"'

おすすめ記事