linux - Why does this sed command to match number not work? -


my command this:

echo "12 cats" | sed 's/[0-9]+/number/g' 

(i'm using sed in vanilla mac)

i expect result be:

number cats 

however, real result is:

12 cats 

does have ideas this? thanks!

expanding + modifier works me:

echo "12 cats" | sed 's/[0-9][0-9]*/number/g' 

also, -e switch make + modifier work, see choroba’s answer.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -