小编Rez*_*eza的帖子

如何使用 jq 替换 json 文件中的值并返回整个内容

我有一个像这样的json

{
  "AgentGroupId": null,
  "AgentId": null,
  "CreateType": "Website",
  "IsPrimary": true,
  "IsShared": true,
  "HeaderAuthentication": {
    "Headers": [
      {
        "Name": "api-key",
        "Value": "TEST_API_KEY_VALUE-2",
        "OriginalName": null,
        "IsReplacedCredentials": false
      },
      {
        "Name": "Authorization",
        "Value": "",
        "OriginalName": null,
        "IsReplacedCredentials": false
      }
    ],
    "IsEnabled": true
  },
  "IsTimeWindowEnabled": false,
  "AdditionalWebsites": [],
  "BasicAuthenticationApiModel": {
    "Credentials": null,
    "IsEnabled": false,
    "NoChallenge": false
  },
  "ClientCertificateAuthenticationSetting": null,
  "Cookies": null,
  "CrawlAndAttack": true,
  "EnableHeuristicChecksInCustomUrlRewrite": true,
  "ExcludedLinks": [
    {
      "RegexPattern": "gtm\\.js"
    },
    {
      "RegexPattern": "WebResource\\.axd"
    },
    {
      "RegexPattern": "ScriptResource\\.axd"
    }
  ],
  "ExcludedUsageTrackers": [],
  "DisallowedHttpMethods": [], …
Run Code Online (Sandbox Code Playgroud)

json jq

15
推荐指数
1
解决办法
4万
查看次数

如何从字符串中提取版本号

我是 UNIX 新手。

我有一个案例,我想从这些字符串(一次一个字符串)中提取版本号,如下所示,我应该怎么做?

release-2.15-5 > 2.15
release-2.15 > 2.15
2.15 > 2.15
2.15-5 > 2.15
Run Code Online (Sandbox Code Playgroud)

我已经这样做了echo release-2.15-5 | cut -f1 -d'-',但结果不正确

bash

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

bash ×1

jq ×1

json ×1