I would like to remove any suffix from a string starting with the last .svc.
. As a example:
abc.svc.cluster.local
=> abc
abc.svc.svc.cluster.local
=> abc.svc
abc.txt
=> abc.txt
abc.svc.xyz.svc.zzz
=> abc.svc.xyz
svc.xxx
=> svc.xxx
(missing .
before svc)
If I was doing this is Go
, I would find the last index of substring .svc.
and then trim from that index.
How do I do this in bash? Thanks.
https://stackoverflow.com/questions/65791753/how-to-remove-non-gredy-suffix-from-string-in-bash January 19, 2021 at 08:43PM
没有评论:
发表评论