I'm trying to get a value such as


With this (the example is replacing it with nothing):

sed 's/["][0-9]+[,][0-9]+["]//g'

But it's not working.

  • 6
    What is the text that you are feeding into sed? Does it work if you run with sed -E (your expression looks like an extended regular expression, unless the pluses are supposed to be literal). Why do you use ["] instead of just "? The double quote is not special in a regular expression. Likewise for the comma. Also, you are replacing the matched thing with nothing. – Kusalananda Jun 6 at 21:25
  • @Kusalananda -E did the trick. – Gabriel A. Zorrilla Jun 7 at 12:48

If you want to replace the pattern, you can use sed -E or escape the + characters as suggested by @Kusalananda:

$ printf '"123.456"\n"909,999"\n"100"\n' | sed -E 's/"[0-9]+,[0-9]+"//g'



$ printf '"123.456"\n"909,999"\n"100"\n' | sed 's/"[0-9]\+,[0-9]\+"//g'


Note that the g is not needed in this example as there is only one substitution per line.

If you want to delete the matching line(s), you could use d to delete the pattern space:

$ printf '"123.456"\n"909,999"\n"100"\n' | sed '/"[0-9]\+,[0-9]\+"/d'

Not the answer you're looking for? Browse other questions tagged or ask your own question.