{"id":1351,"date":"2019-04-24T15:49:06","date_gmt":"2019-04-24T20:49:06","guid":{"rendered":"http:\/\/blog.ls-al.com\/?p=1351"},"modified":"2019-04-24T15:49:07","modified_gmt":"2019-04-24T20:49:07","slug":"oci-cli-query","status":"publish","type":"post","link":"https:\/\/blog.ls-al.com\/oci-cli-query\/","title":{"rendered":"OCI Cli Query"},"content":{"rendered":"\n
If you want to manipulate the output of Oracle Cloud Infrastructure CLI commands you can pipe output through jq. I have examples of jq elsewhere. You can also use the query option like follow.<\/p>\n\n\n
\n$ oci network vcn list --compartment-id <> --config-file <> --profile <> --cli-rc-file <> --output table --query 'data [*].{"display-name":"display-name", "vcn-domain-name":"vcn-domain-name" "cidr-block":"cidr-block", "lifecycle-state":"lifecycle-state"}'\n+--------------+-----------------+-----------------+-----------------------------+\n| cidr-block | display-name | lifecycle-state | vcn-domain-name |\n+--------------+-----------------+-----------------+-----------------------------+\n| 10.35.0.0\/17 | My Primary VCN | AVAILABLE | myprimaryvcn.oraclevcn.com |\n+--------------+-----------------+-----------------+-----------------------------+\n<\/pre><\/div>\n\n\nAnd for good measure also a jq example. Plus csv filter.<\/p>\n\n\n
\n$ oci os object list --config-file \/root\/.oci\/config --profile oci-backup --bucket-name "commvault-backup" | jq -r '.data[] | [.name,.size] | @csv'\n"SILTFS_04.23.2019_19.21\/CV_MAGNETIC\/_DIRECTORY_HOLDER_",0\n"SILTFS_04.23.2019_19.21\/_DIRECTORY_HOLDER_",0\n<\/pre><\/div>","protected":false},"excerpt":{"rendered":"If you want to manipulate the output of Oracle Cloud Infrastructure CLI commands you can pipe output through jq. I<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1351","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/posts\/1351","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/comments?post=1351"}],"version-history":[{"count":0,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/posts\/1351\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/media?parent=1351"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/categories?post=1351"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ls-al.com\/wp-json\/wp\/v2\/tags?post=1351"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}