How to match digits followed by a dot using sed?

Because sed is not perl -- sed regexes do not have a \d shorthand:

sed 's/[[:digit:]]\+\.//g'

sed regular expression documentation here.


Two problems:

  1. sed does not support \d. Use [0-9] or [[:digit:]].

  2. + must be backslashed to get the special meaning: \+.


The sed man page references the re_format man page. It makes 2 distinctions: (1) obsolete versus extended regular expressions; (2) non-enhanced versus enhanced regular expressions. All 4 combinations are possible. There is support in sed for both obsolete and extended, but in either case only for non-enhanced. The \d operator is a feature of enhanced regular expressions, therefore not supported by sed.

Tags:

Regex

Sed