sed pattern for "1.2", "1.2.3", "1.2.3.4", "1.2.3.4.5", …
I am trying to use sed
for matching this pattern: it has multiple parts, each part is separated by a full stop, and the content is a non-empty sequence of digits, like:
"1", "1.2", "192.168.0.1", …
Does sed
support grouping a sequence of regex a开发者_运维问答s a group and use +
or *
, etc. on it?
I'm grateful for any help. Thank you!
Since you are matching patten you can use grep
as:
grep -Eo '[0-9]+(\.[0-9]+)*'
In sed
you can do:
sed -r 's/[0-9]+(\.[0-9]+)*/replacement/'
See it
精彩评论