So, I have an output from a command (kustomize build
) and I want to convert the ---
in the output to ###
. For example:
$ kustomize build
apiVersion: extensions/v1
kind: Ingress
metadata:
labels:
app: hello-world
---
apiVersion: v1
kind: Service
metadata:
name: hello-world
spec:
ports:
- name: service
port: 443
targetPort: 8443
selector:
app: hello-world
type: NodePort
and I want to change it to :
apiVersion: extensions/v1
kind: Ingress
metadata:
labels:
app: hello-world
###
apiVersion: v1
kind: Service
metadata:
name: hello-world
spec:
ports:
- name: service
port: 443
targetPort: 8443
selector:
app: hello-world
type: NodePort
I tried $ kustomize build | tr '\---' '#'
but that replaces every instance of even a single '-'
to '#'
. I even tried tr '[-]{3}' '#'
but even that didn't help. How can I go about doing this?