user2036880 user2036880 - 5 months ago 35
Linux Question

Why does `\d` doesn't work in regular expression in sed

I am trying to use

in regex in sed but it don't work

sed -re 's/\d+//g'

But this is working

sed -re 's/[0-9]+//g'


\d is a switch not a regular expression macro. If you want to use some predefined "constant" istead of [0-9] expression just try run this code