Update content/en/docs/reference/kubectl/jsonpath.md

Co-authored-by: Tim Bannister <tim@scalefactory.com>
pull/23141/head
Daniel Mendes 2020-08-26 19:55:26 +02:00 committed by GitHub
parent 6262a5dae3
commit 5a4c534e57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 2 deletions

View File

@ -103,7 +103,7 @@ kubectl get pods -o=jsonpath="{range .items[*]}{.metadata.name}{\"\t\"}{.status.
JSONPath regular expressions are not supported. If you want to match using regular expressions, you can use a tool such as `jq`. JSONPath regular expressions are not supported. If you want to match using regular expressions, you can use a tool such as `jq`.
```shell ```shell
# kubectl does not suport regular expressions # kubectl does not support regular expressions for JSONpath output
# The following command does not work # The following command does not work
kubectl get pods -o jsonpath='{.items[?(@.metadata.name=~/^test$/)].metadata.name}' kubectl get pods -o jsonpath='{.items[?(@.metadata.name=~/^test$/)].metadata.name}'
@ -111,4 +111,3 @@ kubectl get pods -o jsonpath='{.items[?(@.metadata.name=~/^test$/)].metadata.nam
kubectl get pods -o json | jq -r '.items[] | select(.metadata.name | test("test-")).spec.containers[].image' kubectl get pods -o json | jq -r '.items[] | select(.metadata.name | test("test-")).spec.containers[].image'
``` ```
{{< /note >}} {{< /note >}}