Update content/en/docs/reference/kubectl/jsonpath.md
Co-authored-by: Tim Bannister <tim@scalefactory.com>pull/23141/head
parent
6262a5dae3
commit
5a4c534e57
|
@ -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 >}}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue