I have an ansible inventory that I need to remove all cases that start with site2-
.
For example I have a list that includes groups named:
[site2-static-web]
site2-ansible
site2-accounts
site2-admin
site2-analytics
site2-audit
site2-botruntime
site2-campaigns
site2-config
site2-coupons
site2-edge
site2-minio
site2-permissions
site2-registry
site2-surveys
site2-websockets
site2-amc-server
site2-static-web
site2-elasticsearch
site2-logstash
site2-kibana
site2-keycloak
site2-pgsql
site2-mysql
site2-rabbitmq
site2-redis
site2-zipkin
I tried sed -i.bak 's/site2-*///g' mmp_default
but all that got me was the site2
removed with the ends left in.
site2-ansible
site2-accounts
Became:
ansible
accounts
How can I do this correctly?
so I first choose matching lines on words I need separated by \| then only I cut the useless word "site2-". You can still add -i.bak if needed