cat README.md | tr " " "\n" | tr -d '[:punct:]' | sort | uniq -c | sort -n -k 1This example is a bit like functional programming: in each step of the pipeline the output depends only on the input received via the preceding pipe, each step acts on that text input only and produces its output without writing any files, that is without side effects.
cat s1.json |
---|
{ "kind": "Deployment", "spec": { "replicas": 1 } } |
cat data/s1.json | cat data/s1.json | jq '.spec.replicas' |
---|---|
{ "kind": "Deployment", "spec": { "replicas": 1 } } |
1 |
cat data/s1.json | jq ".spec.replicas" |
---|
1 |
cat s1.json |
---|
{ "kind": "Deployment", "spec": { "replicas": 1 } } |
cat data/s1.json | cat data/s1.json | jq '.spec ' |
---|---|
{ "kind": "Deployment", "spec": { "replicas": 1 } } |
{ "replicas": 1 } |
cat data/s1.json | jq ".spec " |
---|
{ "replicas": 1 } |
cat data/s1.json | jq '.spec ' | cat data/s1.json | jq '.spec | .replicas' |
---|---|
{ "replicas": 1 } |
1 |
cat data/s1.json | jq ".spec | .replicas" |
---|
1 |
cat s1.json |
---|
{ "kind": "Deployment", "spec": { "replicas": 1 } } |
cat data/s1.json | cat data/s1.json | jq '.spec.replicas, .kind' |
---|---|
{ "kind": "Deployment", "spec": { "replicas": 1 } } |
1 "Deployment" |
cat data/s1.json | jq ".spec.replicas, .kind" |
---|
1 "Deployment" |
cat s1.json |
---|
{ "kind": "Deployment", "spec": { "replicas": 1 } } |
cat data/s1.json | cat data/s1.json | jq '"replicas: " + (.spec.replicas | tostring) + " kind: " + .kind' |
---|---|
{ "kind": "Deployment", "spec": { "replicas": 1 } } |
"replicas: 1 kind: Deployment" |
cat data/s1.json | jq ""replicas: " + (.spec.replicas | tostring) + " kind: " + .kind" |
---|
"replicas: 1 kind: Deployment" |
cat dep.json |
---|
{ "apiVersion": "apps/v1", "kind": "Deployment", "metadata": { "annotations": { "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "" }, "creationTimestamp": "2020-01-23T03:47:56Z", "generation": 1, "labels": { "api": "clusterapi", "k8s-app": "controller" }, "name": "machine-api-controllers", "namespace": "openshift-machine-api", "resourceVersion": "5089", "selfLink": "/apis/apps/v1/namespaces/openshift-machine-api/deployments/machine-api-controllers", "uid": "a0e8ba08-37c5-40b0-b006-83a6274d89bd" }, "spec": { "progressDeadlineSeconds": 600, "replicas": 1, "revisionHistoryLimit": 10, "selector": { "matchLabels": { "api": "clusterapi", "k8s-app": "controller" } }, "strategy": { "rollingUpdate": { "maxSurge": "25%", "maxUnavailable": "25%" }, "type": "RollingUpdate" }, "template": { "metadata": { "creationTimestamp": null, "labels": { "api": "clusterapi", "k8s-app": "controller" } }, "spec": { "containers": [ { "args": [ "--logtostderr=true", "--v=3", "--namespace=openshift-machine-api" ], "command": [ "/manager" ], "image": "registry.svc.ci.openshift.org/ocp/4.4-2020-01-22-110636@sha256:4ad536231654ffbc590103c7d25bd11dcd4d8dfda645845d762b442b5561242b", "imagePullPolicy": "IfNotPresent", "name": "controller-manager", "resources": { "requests": { "cpu": "10m", "memory": "20Mi" } }, "terminationMessagePath": "/dev/termination-log", "terminationMessagePolicy": "File" }, { "args": [ "--logtostderr=true", "--v=3", "--namespace=openshift-machine-api" ], "command": [ "/machine-controller-manager" ], "env": [ { "name": "NODE_NAME", "valueFrom": { "fieldRef": { "apiVersion": "v1", "fieldPath": "spec.nodeName" } } } ], "image": "registry.svc.ci.openshift.org/ocp/4.4-2020-01-22-110636@sha256:4ad536231654ffbc590103c7d25bd11dcd4d8dfda645845d762b442b5561242b", "imagePullPolicy": "IfNotPresent", "name": "machine-controller", "resources": { "requests": { "cpu": "10m", "memory": "20Mi" } }, "terminationMessagePath": "/dev/termination-log", "terminationMessagePolicy": "File" }, { "args": [ "--logtostderr=true", "--v=3", "--namespace=openshift-machine-api" ], "command": [ "/nodelink-controller" ], "image": "registry.svc.ci.openshift.org/ocp/4.4-2020-01-22-110636@sha256:215d0dd0af4c72fdde0b492d8988a0bd9265ba155d590551a9841e877062d490", "imagePullPolicy": "IfNotPresent", "name": "nodelink-controller", "resources": { "requests": { "cpu": "10m", "memory": "20Mi" } }, "terminationMessagePath": "/dev/termination-log", "terminationMessagePolicy": "File" }, { "args": [ "--logtostderr=true", "--v=3", "--namespace=openshift-machine-api" ], "command": [ "/machine-healthcheck" ], "image": "registry.svc.ci.openshift.org/ocp/4.4-2020-01-22-110636@sha256:215d0dd0af4c72fdde0b492d8988a0bd9265ba155d590551a9841e877062d490", "imagePullPolicy": "IfNotPresent", "name": "machine-healthcheck-controller", "resources": { "requests": { "cpu": "10m", "memory": "20Mi" } }, "terminationMessagePath": "/dev/termination-log", "terminationMessagePolicy": "File" } ], "dnsPolicy": "ClusterFirst", "nodeSelector": { "node-role.kubernetes.io/master": "" }, "priorityClassName": "system-node-critical", "restartPolicy": "Always", "schedulerName": "default-scheduler", "securityContext": { "runAsNonRoot": true, "runAsUser": 65534 }, "serviceAccount": "machine-api-controllers", "serviceAccountName": "machine-api-controllers", "terminationGracePeriodSeconds": 30, "tolerations": [ { "effect": "NoSchedule", "key": "node-role.kubernetes.io/master" }, { "key": "CriticalAddonsOnly", "operator": "Exists" }, { "effect": "NoExecute", "key": "node.kubernetes.io/not-ready", "operator": "Exists", "tolerationSeconds": 120 }, { "effect": "NoExecute", "key": "node.kubernetes.io/unreachable", "operator": "Exists", "tolerationSeconds": 120 } ] } } }, "status": { "availableReplicas": 1, "conditions": [ { "lastTransitionTime": "2020-01-23T03:48:23Z", "lastUpdateTime": "2020-01-23T03:48:23Z", "message": "Deployment has minimum availability.", "reason": "MinimumReplicasAvailable", "status": "True", "type": "Available" }, { "lastTransitionTime": "2020-01-23T03:47:56Z", "lastUpdateTime": "2020-01-23T03:48:23Z", "message": "ReplicaSet \"machine-api-controllers-5f4ddff7f4\" has successfully progressed.", "reason": "NewReplicaSetAvailable", "status": "True", "type": "Progressing" } ], "observedGeneration": 1, "readyReplicas": 1, "replicas": 1, "updatedReplicas": 1 } } |
cat data/dep.json | cat data/dep.json | jq '.status.conditions ' |
---|---|
{ "apiVersion": "apps/v1", "kind": "Deployment", "metadata": { "annotations": { "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "" }, "creationTimestamp": "2020-01-23T03:47:56Z", "generation": 1, "labels": { "api": "clusterapi", "k8s-app": "controller" }, "name": "machine-api-controllers", "namespace": "openshift-machine-api", "resourceVersion": "5089", "selfLink": "/apis/apps/v1/namespaces/openshift-machine-api/deployments/machine-api-controllers", "uid": "a0e8ba08-37c5-40b0-b006-83a6274d89bd" }, "spec": { "progressDeadlineSeconds": 600, "replicas": 1, "revisionHistoryLimit": 10, "selector": { "matchLabels": { "api": "clusterapi", "k8s-app": "controller" } }, "strategy": { "rollingUpdate": { "maxSurge": "25%", "maxUnavailable": "25%" }, "type": "RollingUpdate" }, "template": { "metadata": { "creationTimestamp": null, "labels": { "api": "clusterapi", "k8s-app": "controller" } }, "spec": { "containers": [ { "args": [ "--logtostderr=true", "--v=3", "--namespace=openshift-machine-api" ], "command": [ "/manager" ], "image": "registry.svc.ci.openshift.org/ocp/4.4-2020-01-22-110636@sha256:4ad536231654ffbc590103c7d25bd11dcd4d8dfda645845d762b442b5561242b", "imagePullPolicy": "IfNotPresent", "name": "controller-manager", "resources": { "requests": { "cpu": "10m", "memory": "20Mi" } }, "terminationMessagePath": "/dev/termination-log", "terminationMessagePolicy": "File" }, { "args": [ "--logtostderr=true", "--v=3", "--namespace=openshift-machine-api" ], "command": [ "/machine-controller-manager" ], "env": [ { "name": "NODE_NAME", "valueFrom": { "fieldRef": { "apiVersion": "v1", "fieldPath": "spec.nodeName" } } } ], "image": "registry.svc.ci.openshift.org/ocp/4.4-2020-01-22-110636@sha256:4ad536231654ffbc590103c7d25bd11dcd4d8dfda645845d762b442b5561242b", "imagePullPolicy": "IfNotPresent", "name": "machine-controller", "resources": { "requests": { "cpu": "10m", "memory": "20Mi" } }, "terminationMessagePath": "/dev/termination-log", "terminationMessagePolicy": "File" }, { "args": [ "--logtostderr=true", "--v=3", "--namespace=openshift-machine-api" ], "command": [ "/nodelink-controller" ], "image": "registry.svc.ci.openshift.org/ocp/4.4-2020-01-22-110636@sha256:215d0dd0af4c72fdde0b492d8988a0bd9265ba155d590551a9841e877062d490", "imagePullPolicy": "IfNotPresent", "name": "nodelink-controller", "resources": { "requests": { "cpu": "10m", "memory": "20Mi" } }, "terminationMessagePath": "/dev/termination-log", "terminationMessagePolicy": "File" }, { "args": [ "--logtostderr=true", "--v=3", "--namespace=openshift-machine-api" ], "command": [ "/machine-healthcheck" ], "image": "registry.svc.ci.openshift.org/ocp/4.4-2020-01-22-110636@sha256:215d0dd0af4c72fdde0b492d8988a0bd9265ba155d590551a9841e877062d490", "imagePullPolicy": "IfNotPresent", "name": "machine-healthcheck-controller", "resources": { "requests": { "cpu": "10m", "memory": "20Mi" } }, "terminationMessagePath": "/dev/termination-log", "terminationMessagePolicy": "File" } ], "dnsPolicy": "ClusterFirst", "nodeSelector": { "node-role.kubernetes.io/master": "" }, "priorityClassName": "system-node-critical", "restartPolicy": "Always", "schedulerName": "default-scheduler", "securityContext": { "runAsNonRoot": true, "runAsUser": 65534 }, "serviceAccount": "machine-api-controllers", "serviceAccountName": "machine-api-controllers", "terminationGracePeriodSeconds": 30, "tolerations": [ { "effect": "NoSchedule", "key": "node-role.kubernetes.io/master" }, { "key": "CriticalAddonsOnly", "operator": "Exists" }, { "effect": "NoExecute", "key": "node.kubernetes.io/not-ready", "operator": "Exists", "tolerationSeconds": 120 }, { "effect": "NoExecute", "key": "node.kubernetes.io/unreachable", "operator": "Exists", "tolerationSeconds": 120 } ] } } }, "status": { "availableReplicas": 1, "conditions": [ { "lastTransitionTime": "2020-01-23T03:48:23Z", "lastUpdateTime": "2020-01-23T03:48:23Z", "message": "Deployment has minimum availability.", "reason": "MinimumReplicasAvailable", "status": "True", "type": "Available" }, { "lastTransitionTime": "2020-01-23T03:47:56Z", "lastUpdateTime": "2020-01-23T03:48:23Z", "message": "ReplicaSet \"machine-api-controllers-5f4ddff7f4\" has successfully progressed.", "reason": "NewReplicaSetAvailable", "status": "True", "type": "Progressing" } ], "observedGeneration": 1, "readyReplicas": 1, "replicas": 1, "updatedReplicas": 1 } } |
[ { "lastTransitionTime": "2020-01-23T03:48:23Z", "lastUpdateTime": "2020-01-23T03:48:23Z", "message": "Deployment has minimum availability.", "reason": "MinimumReplicasAvailable", "status": "True", "type": "Available" }, { "lastTransitionTime": "2020-01-23T03:47:56Z", "lastUpdateTime": "2020-01-23T03:48:23Z", "message": "ReplicaSet \"machine-api-controllers-5f4ddff7f4\" has successfully progressed.", "reason": "NewReplicaSetAvailable", "status": "True", "type": "Progressing" } ] |
cat data/dep.json | jq ".status.conditions " |
---|
[ { "lastTransitionTime": "2020-01-23T03:48:23Z", "lastUpdateTime": "2020-01-23T03:48:23Z", "message": "Deployment has minimum availability.", "reason": "MinimumReplicasAvailable", "status": "True", "type": "Available" }, { "lastTransitionTime": "2020-01-23T03:47:56Z", "lastUpdateTime": "2020-01-23T03:48:23Z", "message": "ReplicaSet \"machine-api-controllers-5f4ddff7f4\" has successfully progressed.", "reason": "NewReplicaSetAvailable", "status": "True", "type": "Progressing" } ] |
cat data/dep.json | jq '.status.conditions ' | cat data/dep.json | jq '.status.conditions | map(select(.type == "Progressing"))' |
---|---|
[ { "lastTransitionTime": "2020-01-23T03:48:23Z", "lastUpdateTime": "2020-01-23T03:48:23Z", "message": "Deployment has minimum availability.", "reason": "MinimumReplicasAvailable", "status": "True", "type": "Available" }, { "lastTransitionTime": "2020-01-23T03:47:56Z", "lastUpdateTime": "2020-01-23T03:48:23Z", "message": "ReplicaSet \"machine-api-controllers-5f4ddff7f4\" has successfully progressed.", "reason": "NewReplicaSetAvailable", "status": "True", "type": "Progressing" } ] |
[ { "lastTransitionTime": "2020-01-23T03:47:56Z", "lastUpdateTime": "2020-01-23T03:48:23Z", "message": "ReplicaSet \"machine-api-controllers-5f4ddff7f4\" has successfully progressed.", "reason": "NewReplicaSetAvailable", "status": "True", "type": "Progressing" } ] |
cat data/dep.json | jq ".status.conditions | map(select(.type == "Progressing"))" |
---|
[ { "lastTransitionTime": "2020-01-23T03:47:56Z", "lastUpdateTime": "2020-01-23T03:48:23Z", "message": "ReplicaSet \"machine-api-controllers-5f4ddff7f4\" has successfully progressed.", "reason": "NewReplicaSetAvailable", "status": "True", "type": "Progressing" } ] |
cat ann.json |
---|
{ "metadata": { "annotations": { "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1" : "stam", "label2" : "another", "label3" : "one" } } } |
cat data/ann.json | cat data/ann.json | jq '.metadata.annotations ' |
---|---|
{ "metadata": { "annotations": { "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1" : "stam", "label2" : "another", "label3" : "one" } } } |
{ "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1": "stam", "label2": "another", "label3": "one" } |
cat data/ann.json | jq ".metadata.annotations " |
---|
{ "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1": "stam", "label2": "another", "label3": "one" } |
cat data/ann.json | jq '.metadata.annotations ' | cat data/ann.json | jq '.metadata.annotations | to_entries ' |
---|---|
{ "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1": "stam", "label2": "another", "label3": "one" } |
[ { "key": "deployment.kubernetes.io/revision", "value": "1" }, { "key": "machine.openshift.io/owned", "value": "" }, { "key": "label1", "value": "stam" }, { "key": "label2", "value": "another" }, { "key": "label3", "value": "one" } ] |
cat data/ann.json | jq ".metadata.annotations | to_entries " |
---|
[ { "key": "deployment.kubernetes.io/revision", "value": "1" }, { "key": "machine.openshift.io/owned", "value": "" }, { "key": "label1", "value": "stam" }, { "key": "label2", "value": "another" }, { "key": "label3", "value": "one" } ] |
cat data/ann.json | jq '.metadata.annotations | to_entries ' | cat data/ann.json | jq '.metadata.annotations | to_entries | map(select(.key == "label1")) ' |
---|---|
[ { "key": "deployment.kubernetes.io/revision", "value": "1" }, { "key": "machine.openshift.io/owned", "value": "" }, { "key": "label1", "value": "stam" }, { "key": "label2", "value": "another" }, { "key": "label3", "value": "one" } ] |
[ { "key": "label1", "value": "stam" } ] |
cat data/ann.json | jq ".metadata.annotations | to_entries | map(select(.key == "label1")) " |
---|
[ { "key": "label1", "value": "stam" } ] |
cat data/ann.json | jq '.metadata.annotations | to_entries | map(select(.key == "label1")) ' | cat data/ann.json | jq '.metadata.annotations | to_entries | map(select(.key == "label1")) | from_entries' |
---|---|
[ { "key": "label1", "value": "stam" } ] |
{ "label1": "stam" } |
cat data/ann.json | jq ".metadata.annotations | to_entries | map(select(.key == "label1")) | from_entries" |
---|
{ "label1": "stam" } |
cat ann.json |
---|
{ "metadata": { "annotations": { "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1" : "stam", "label2" : "another", "label3" : "one" } } } |
cat data/ann.json | cat data/ann.json | jq '.metadata.annotations ' |
---|---|
{ "metadata": { "annotations": { "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1" : "stam", "label2" : "another", "label3" : "one" } } } |
{ "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1": "stam", "label2": "another", "label3": "one" } |
cat data/ann.json | jq ".metadata.annotations " |
---|
{ "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1": "stam", "label2": "another", "label3": "one" } |
cat data/ann.json | jq '.metadata.annotations ' | cat data/ann.json | jq '.metadata.annotations | with_entries(select(.key == "label1"))' |
---|---|
{ "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1": "stam", "label2": "another", "label3": "one" } |
{ "label1": "stam" } |
cat data/ann.json | jq ".metadata.annotations | with_entries(select(.key == "label1"))" |
---|
{ "label1": "stam" } |
cat ann.json |
---|
{ "metadata": { "annotations": { "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1" : "stam", "label2" : "another", "label3" : "one" } } } |
cat data/ann.json | cat data/ann.json | jq '.metadata.annotations ' |
---|---|
{ "metadata": { "annotations": { "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1" : "stam", "label2" : "another", "label3" : "one" } } } |
{ "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1": "stam", "label2": "another", "label3": "one" } |
cat data/ann.json | jq ".metadata.annotations " |
---|
{ "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1": "stam", "label2": "another", "label3": "one" } |
cat data/ann.json | jq '.metadata.annotations ' | cat data/ann.json | jq '.metadata.annotations | to_entries ' |
---|---|
{ "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1": "stam", "label2": "another", "label3": "one" } |
[ { "key": "deployment.kubernetes.io/revision", "value": "1" }, { "key": "machine.openshift.io/owned", "value": "" }, { "key": "label1", "value": "stam" }, { "key": "label2", "value": "another" }, { "key": "label3", "value": "one" } ] |
cat data/ann.json | jq ".metadata.annotations | to_entries " |
---|
[ { "key": "deployment.kubernetes.io/revision", "value": "1" }, { "key": "machine.openshift.io/owned", "value": "" }, { "key": "label1", "value": "stam" }, { "key": "label2", "value": "another" }, { "key": "label3", "value": "one" } ] |
cat data/ann.json | jq '.metadata.annotations | to_entries ' | cat data/ann.json | jq '.metadata.annotations | to_entries | map(select(.key == "label1" or .key == "label2")) ' |
---|---|
[ { "key": "deployment.kubernetes.io/revision", "value": "1" }, { "key": "machine.openshift.io/owned", "value": "" }, { "key": "label1", "value": "stam" }, { "key": "label2", "value": "another" }, { "key": "label3", "value": "one" } ] |
[ { "key": "label1", "value": "stam" }, { "key": "label2", "value": "another" } ] |
cat data/ann.json | jq ".metadata.annotations | to_entries | map(select(.key == "label1" or .key == "label2")) " |
---|
[ { "key": "label1", "value": "stam" }, { "key": "label2", "value": "another" } ] |
cat data/ann.json | jq '.metadata.annotations | to_entries | map(select(.key == "label1" or .key == "label2")) ' | cat data/ann.json | jq '.metadata.annotations | to_entries | map(select(.key == "label1" or .key == "label2")) | from_entries' |
---|---|
[ { "key": "label1", "value": "stam" }, { "key": "label2", "value": "another" } ] |
{ "label1": "stam", "label2": "another" } |
cat data/ann.json | jq ".metadata.annotations | to_entries | map(select(.key == "label1" or .key == "label2")) | from_entries" |
---|
{ "label1": "stam", "label2": "another" } |
cat ann.json |
---|
{ "metadata": { "annotations": { "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1" : "stam", "label2" : "another", "label3" : "one" } } } |
cat data/ann.json | cat data/ann.json | jq '.metadata.annotations ' |
---|---|
{ "metadata": { "annotations": { "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1" : "stam", "label2" : "another", "label3" : "one" } } } |
{ "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1": "stam", "label2": "another", "label3": "one" } |
cat data/ann.json | jq ".metadata.annotations " |
---|
{ "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1": "stam", "label2": "another", "label3": "one" } |
cat data/ann.json | jq '.metadata.annotations ' | cat data/ann.json | jq '.metadata.annotations | to_entries ' |
---|---|
{ "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1": "stam", "label2": "another", "label3": "one" } |
[ { "key": "deployment.kubernetes.io/revision", "value": "1" }, { "key": "machine.openshift.io/owned", "value": "" }, { "key": "label1", "value": "stam" }, { "key": "label2", "value": "another" }, { "key": "label3", "value": "one" } ] |
cat data/ann.json | jq ".metadata.annotations | to_entries " |
---|
[ { "key": "deployment.kubernetes.io/revision", "value": "1" }, { "key": "machine.openshift.io/owned", "value": "" }, { "key": "label1", "value": "stam" }, { "key": "label2", "value": "another" }, { "key": "label3", "value": "one" } ] |
cat data/ann.json | jq '.metadata.annotations | to_entries ' | cat data/ann.json | jq '.metadata.annotations | to_entries | map(select(.key == ("label1", "label2"))) ' |
---|---|
[ { "key": "deployment.kubernetes.io/revision", "value": "1" }, { "key": "machine.openshift.io/owned", "value": "" }, { "key": "label1", "value": "stam" }, { "key": "label2", "value": "another" }, { "key": "label3", "value": "one" } ] |
[ { "key": "label1", "value": "stam" }, { "key": "label2", "value": "another" } ] |
cat data/ann.json | jq ".metadata.annotations | to_entries | map(select(.key == ("label1", "label2"))) " |
---|
[ { "key": "label1", "value": "stam" }, { "key": "label2", "value": "another" } ] |
cat data/ann.json | jq '.metadata.annotations | to_entries | map(select(.key == ("label1", "label2"))) ' | cat data/ann.json | jq '.metadata.annotations | to_entries | map(select(.key == ("label1", "label2"))) | from_entries ' |
---|---|
[ { "key": "label1", "value": "stam" }, { "key": "label2", "value": "another" } ] |
{ "label1": "stam", "label2": "another" } |
cat data/ann.json | jq ".metadata.annotations | to_entries | map(select(.key == ("label1", "label2"))) | from_entries " |
---|
{ "label1": "stam", "label2": "another" } |
cat ann.json |
---|
{ "metadata": { "annotations": { "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1" : "stam", "label2" : "another", "label3" : "one" } } } |
cat data/ann.json | cat data/ann.json | jq '.metadata.annotations ' |
---|---|
{ "metadata": { "annotations": { "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1" : "stam", "label2" : "another", "label3" : "one" } } } |
{ "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1": "stam", "label2": "another", "label3": "one" } |
cat data/ann.json | jq ".metadata.annotations " |
---|
{ "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1": "stam", "label2": "another", "label3": "one" } |
cat data/ann.json | jq '.metadata.annotations ' | cat data/ann.json | jq '.metadata.annotations | to_entries ' |
---|---|
{ "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1": "stam", "label2": "another", "label3": "one" } |
[ { "key": "deployment.kubernetes.io/revision", "value": "1" }, { "key": "machine.openshift.io/owned", "value": "" }, { "key": "label1", "value": "stam" }, { "key": "label2", "value": "another" }, { "key": "label3", "value": "one" } ] |
cat data/ann.json | jq ".metadata.annotations | to_entries " |
---|
[ { "key": "deployment.kubernetes.io/revision", "value": "1" }, { "key": "machine.openshift.io/owned", "value": "" }, { "key": "label1", "value": "stam" }, { "key": "label2", "value": "another" }, { "key": "label3", "value": "one" } ] |
cat data/ann.json | jq '.metadata.annotations | to_entries ' | cat data/ann.json | jq '.metadata.annotations | to_entries | map(select(.key | contains("label"))) ' |
---|---|
[ { "key": "deployment.kubernetes.io/revision", "value": "1" }, { "key": "machine.openshift.io/owned", "value": "" }, { "key": "label1", "value": "stam" }, { "key": "label2", "value": "another" }, { "key": "label3", "value": "one" } ] |
[ { "key": "label1", "value": "stam" }, { "key": "label2", "value": "another" }, { "key": "label3", "value": "one" } ] |
cat data/ann.json | jq ".metadata.annotations | to_entries | map(select(.key | contains("label"))) " |
---|
[ { "key": "label1", "value": "stam" }, { "key": "label2", "value": "another" }, { "key": "label3", "value": "one" } ] |
cat data/ann.json | jq '.metadata.annotations | to_entries | map(select(.key | contains("label"))) ' | cat data/ann.json | jq '.metadata.annotations | to_entries | map(select(.key | contains("label"))) | from_entries' |
---|---|
[ { "key": "label1", "value": "stam" }, { "key": "label2", "value": "another" }, { "key": "label3", "value": "one" } ] |
{ "label1": "stam", "label2": "another", "label3": "one" } |
cat data/ann.json | jq ".metadata.annotations | to_entries | map(select(.key | contains("label"))) | from_entries" |
---|
{ "label1": "stam", "label2": "another", "label3": "one" } |
cat ann.json |
---|
{ "metadata": { "annotations": { "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1" : "stam", "label2" : "another", "label3" : "one" } } } |
cat data/ann.json | cat data/ann.json | jq ' .metadata.annotations ' |
---|---|
{ "metadata": { "annotations": { "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1" : "stam", "label2" : "another", "label3" : "one" } } } |
{ "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1": "stam", "label2": "another", "label3": "one" } |
cat data/ann.json | jq " .metadata.annotations " |
---|
{ "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1": "stam", "label2": "another", "label3": "one" } |
cat data/ann.json | jq ' .metadata.annotations ' | cat data/ann.json | jq ' .metadata.annotations | to_entries ' |
---|---|
{ "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1": "stam", "label2": "another", "label3": "one" } |
[ { "key": "deployment.kubernetes.io/revision", "value": "1" }, { "key": "machine.openshift.io/owned", "value": "" }, { "key": "label1", "value": "stam" }, { "key": "label2", "value": "another" }, { "key": "label3", "value": "one" } ] |
cat data/ann.json | jq " .metadata.annotations | to_entries " |
---|
[ { "key": "deployment.kubernetes.io/revision", "value": "1" }, { "key": "machine.openshift.io/owned", "value": "" }, { "key": "label1", "value": "stam" }, { "key": "label2", "value": "another" }, { "key": "label3", "value": "one" } ] |
cat data/ann.json | jq ' .metadata.annotations | to_entries ' | cat data/ann.json | jq ' .metadata.annotations | to_entries | map(select(.key | test("label[1-9]"))) ' |
---|---|
[ { "key": "deployment.kubernetes.io/revision", "value": "1" }, { "key": "machine.openshift.io/owned", "value": "" }, { "key": "label1", "value": "stam" }, { "key": "label2", "value": "another" }, { "key": "label3", "value": "one" } ] |
[ { "key": "label1", "value": "stam" }, { "key": "label2", "value": "another" }, { "key": "label3", "value": "one" } ] |
cat data/ann.json | jq " .metadata.annotations | to_entries | map(select(.key | test("label[1-9]"))) " |
---|
[ { "key": "label1", "value": "stam" }, { "key": "label2", "value": "another" }, { "key": "label3", "value": "one" } ] |
cat data/ann.json | jq ' .metadata.annotations | to_entries | map(select(.key | test("label[1-9]"))) ' | cat data/ann.json | jq ' .metadata.annotations | to_entries | map(select(.key | test("label[1-9]"))) | from_entries ' |
---|---|
[ { "key": "label1", "value": "stam" }, { "key": "label2", "value": "another" }, { "key": "label3", "value": "one" } ] |
{ "label1": "stam", "label2": "another", "label3": "one" } |
cat data/ann.json | jq " .metadata.annotations | to_entries | map(select(.key | test("label[1-9]"))) | from_entries " |
---|
{ "label1": "stam", "label2": "another", "label3": "one" } |
cat ann.json |
---|
{ "metadata": { "annotations": { "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1" : "stam", "label2" : "another", "label3" : "one" } } } |
cat data/ann.json | cat data/ann.json | jq '.metadata.annotations ' |
---|---|
{ "metadata": { "annotations": { "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1" : "stam", "label2" : "another", "label3" : "one" } } } |
{ "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1": "stam", "label2": "another", "label3": "one" } |
cat data/ann.json | jq ".metadata.annotations " |
---|
{ "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1": "stam", "label2": "another", "label3": "one" } |
cat data/ann.json | jq '.metadata.annotations ' | cat data/ann.json | jq '.metadata.annotations | with_entries(select(.key | contains("label")))' |
---|---|
{ "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1": "stam", "label2": "another", "label3": "one" } |
{ "label1": "stam", "label2": "another", "label3": "one" } |
cat data/ann.json | jq ".metadata.annotations | with_entries(select(.key | contains("label")))" |
---|
{ "label1": "stam", "label2": "another", "label3": "one" } |
cat ann.json |
---|
{ "metadata": { "annotations": { "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1" : "stam", "label2" : "another", "label3" : "one" } } } |
cat data/ann.json | cat data/ann.json | jq '.metadata.annotations += { "label4" : "two" }' |
---|---|
{ "metadata": { "annotations": { "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1" : "stam", "label2" : "another", "label3" : "one" } } } |
{ "metadata": { "annotations": { "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1": "stam", "label2": "another", "label3": "one", "label4": "two" } } } |
cat data/ann.json | jq ".metadata.annotations += { "label4" : "two" }" |
---|
{ "metadata": { "annotations": { "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1": "stam", "label2": "another", "label3": "one", "label4": "two" } } } |
cat ann.json |
---|
{ "metadata": { "annotations": { "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1" : "stam", "label2" : "another", "label3" : "one" } } } |
cat data/ann.json | cat data/ann.json | jq '.metadata.annotations ' |
---|---|
{ "metadata": { "annotations": { "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1" : "stam", "label2" : "another", "label3" : "one" } } } |
{ "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1": "stam", "label2": "another", "label3": "one" } |
cat data/ann.json | jq ".metadata.annotations " |
---|
{ "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1": "stam", "label2": "another", "label3": "one" } |
cat data/ann.json | jq '.metadata.annotations ' | cat data/ann.json | jq '.metadata.annotations | to_entries ' |
---|---|
{ "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1": "stam", "label2": "another", "label3": "one" } |
[ { "key": "deployment.kubernetes.io/revision", "value": "1" }, { "key": "machine.openshift.io/owned", "value": "" }, { "key": "label1", "value": "stam" }, { "key": "label2", "value": "another" }, { "key": "label3", "value": "one" } ] |
cat data/ann.json | jq ".metadata.annotations | to_entries " |
---|
[ { "key": "deployment.kubernetes.io/revision", "value": "1" }, { "key": "machine.openshift.io/owned", "value": "" }, { "key": "label1", "value": "stam" }, { "key": "label2", "value": "another" }, { "key": "label3", "value": "one" } ] |
cat data/ann.json | jq '.metadata.annotations | to_entries ' | cat data/ann.json | jq '.metadata.annotations | to_entries | map_values(.value="override-value") ' |
---|---|
[ { "key": "deployment.kubernetes.io/revision", "value": "1" }, { "key": "machine.openshift.io/owned", "value": "" }, { "key": "label1", "value": "stam" }, { "key": "label2", "value": "another" }, { "key": "label3", "value": "one" } ] |
[ { "key": "deployment.kubernetes.io/revision", "value": "override-value" }, { "key": "machine.openshift.io/owned", "value": "override-value" }, { "key": "label1", "value": "override-value" }, { "key": "label2", "value": "override-value" }, { "key": "label3", "value": "override-value" } ] |
cat data/ann.json | jq ".metadata.annotations | to_entries | map_values(.value="override-value") " |
---|
[ { "key": "deployment.kubernetes.io/revision", "value": "override-value" }, { "key": "machine.openshift.io/owned", "value": "override-value" }, { "key": "label1", "value": "override-value" }, { "key": "label2", "value": "override-value" }, { "key": "label3", "value": "override-value" } ] |
cat data/ann.json | jq '.metadata.annotations | to_entries | map_values(.value="override-value") ' | cat data/ann.json | jq '.metadata.annotations | to_entries | map_values(.value="override-value") | from_entries' |
---|---|
[ { "key": "deployment.kubernetes.io/revision", "value": "override-value" }, { "key": "machine.openshift.io/owned", "value": "override-value" }, { "key": "label1", "value": "override-value" }, { "key": "label2", "value": "override-value" }, { "key": "label3", "value": "override-value" } ] |
{ "deployment.kubernetes.io/revision": "override-value", "machine.openshift.io/owned": "override-value", "label1": "override-value", "label2": "override-value", "label3": "override-value" } |
cat data/ann.json | jq ".metadata.annotations | to_entries | map_values(.value="override-value") | from_entries" |
---|
{ "deployment.kubernetes.io/revision": "override-value", "machine.openshift.io/owned": "override-value", "label1": "override-value", "label2": "override-value", "label3": "override-value" } |
cat ann.json |
---|
{ "metadata": { "annotations": { "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1" : "stam", "label2" : "another", "label3" : "one" } } } |
cat data/ann.json | cat data/ann.json | jq '.metadata.annotations ' |
---|---|
{ "metadata": { "annotations": { "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1" : "stam", "label2" : "another", "label3" : "one" } } } |
{ "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1": "stam", "label2": "another", "label3": "one" } |
cat data/ann.json | jq ".metadata.annotations " |
---|
{ "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1": "stam", "label2": "another", "label3": "one" } |
cat data/ann.json | jq '.metadata.annotations ' | cat data/ann.json | jq '.metadata.annotations | to_entries ' |
---|---|
{ "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1": "stam", "label2": "another", "label3": "one" } |
[ { "key": "deployment.kubernetes.io/revision", "value": "1" }, { "key": "machine.openshift.io/owned", "value": "" }, { "key": "label1", "value": "stam" }, { "key": "label2", "value": "another" }, { "key": "label3", "value": "one" } ] |
cat data/ann.json | jq ".metadata.annotations | to_entries " |
---|
[ { "key": "deployment.kubernetes.io/revision", "value": "1" }, { "key": "machine.openshift.io/owned", "value": "" }, { "key": "label1", "value": "stam" }, { "key": "label2", "value": "another" }, { "key": "label3", "value": "one" } ] |
cat data/ann.json | jq '.metadata.annotations | to_entries ' | cat data/ann.json | jq '.metadata.annotations | to_entries | map(if .key | contains("label") then .value="kuku" else . end) ' |
---|---|
[ { "key": "deployment.kubernetes.io/revision", "value": "1" }, { "key": "machine.openshift.io/owned", "value": "" }, { "key": "label1", "value": "stam" }, { "key": "label2", "value": "another" }, { "key": "label3", "value": "one" } ] |
[ { "key": "deployment.kubernetes.io/revision", "value": "1" }, { "key": "machine.openshift.io/owned", "value": "" }, { "key": "label1", "value": "kuku" }, { "key": "label2", "value": "kuku" }, { "key": "label3", "value": "kuku" } ] |
cat data/ann.json | jq ".metadata.annotations | to_entries | map(if .key | contains("label") then .value="kuku" else . end) " |
---|
[ { "key": "deployment.kubernetes.io/revision", "value": "1" }, { "key": "machine.openshift.io/owned", "value": "" }, { "key": "label1", "value": "kuku" }, { "key": "label2", "value": "kuku" }, { "key": "label3", "value": "kuku" } ] |
cat data/ann.json | jq '.metadata.annotations | to_entries | map(if .key | contains("label") then .value="kuku" else . end) ' | cat data/ann.json | jq '.metadata.annotations | to_entries | map(if .key | contains("label") then .value="kuku" else . end) | from_entries' |
---|---|
[ { "key": "deployment.kubernetes.io/revision", "value": "1" }, { "key": "machine.openshift.io/owned", "value": "" }, { "key": "label1", "value": "kuku" }, { "key": "label2", "value": "kuku" }, { "key": "label3", "value": "kuku" } ] |
{ "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1": "kuku", "label2": "kuku", "label3": "kuku" } |
cat data/ann.json | jq ".metadata.annotations | to_entries | map(if .key | contains("label") then .value="kuku" else . end) | from_entries" |
---|
{ "deployment.kubernetes.io/revision": "1", "machine.openshift.io/owned": "", "label1": "kuku", "label2": "kuku", "label3": "kuku" } |