【问题标题】:OCI CLI command failing with Parse error when using --output table使用 --output 表时 OCI CLI 命令失败并出现解析错误
【发布时间】:2021-10-14 12:54:40
【问题描述】:

我正在尝试一个简单的 OCI CLI 命令,但在没有选项 --output table 的情况下运行时工作得非常好,但是当我添加该选项 --output table 时,它​​给出了解析错误。 如果我在这里错过任何东西,请告诉我..

工作指令

 oci --profile $PROF bastion session list --all --bastion-id $BSTN_OCID  |jq -r '.data[].id'

失败的命令

 oci --profile $PROF bastion session list --all --bastion-id $BSTN_OCID --output table |jq -r '.data[].id'

错误

parse error: Invalid numeric literal at line 2, column 0

【问题讨论】:

  • 通过图像搜索,看起来--output table 生成了一个 ASCII 表。为什么您希望jq 能够处理表面上不是 JSON 的东西?
  • 好的,知道了。我能够使用 --query 做到这一点

标签: jq oracle-cloud-infrastructure


【解决方案1】:

由 Botje 更新 - JQ 无法处理,因为它不是 JSON。我使用了 --query 并且成功了。

oci bastion session list  --bastion-id  $BSTN_OCID --output table --profile $PROF --all --query 'data[].id'

【讨论】:

    猜你喜欢
    • 2022-07-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-16
    • 2018-10-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多