Skip to main content

I have a string like:

schedule="0.25"

and I want to replace the 0.25 lets say with 0.50

I could achieve this with:

sed 's/\"....\"/\"0\.50\"/g'

the problem is I don't know the value between the double quotes, and therefore I do not know the length. It could be any value, but it will be always preceded by schedule=.

I have a string like:

schedule="0.25"

and I want to replace the 0.25 lets say with 0.50

I could achieve this with:

sed 's/\"....\"/\"0\.50\"/g'

the problem is I don't know the value between the double quotes, and therefore I do not know the length. It could be any value.

I have a string like:

schedule="0.25"

and I want to replace the 0.25 lets say with 0.50

I could achieve this with:

sed 's/\"....\"/\"0\.50\"/g'

the problem is I don't know the value between the double quotes, and therefore I do not know the length. It could be any value, but it will be always preceded by schedule=.

Became Hot Network Question
Source Link
nath
  • 6.1k
  • 13
  • 51
  • 94

Replace value with variable length between double quotes

I have a string like:

schedule="0.25"

and I want to replace the 0.25 lets say with 0.50

I could achieve this with:

sed 's/\"....\"/\"0\.50\"/g'

the problem is I don't know the value between the double quotes, and therefore I do not know the length. It could be any value.