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
Post a Comment