A
A
Aleksandr Varag2016-12-09 15:45:58
bash
Aleksandr Varag, 2016-12-09 15:45:58

How to find and replace the variable field="1.0.0" with field="$var" in a file?

How to find and replace the variable field="1.0.0" with field="$var" in a file?
do:
a=`cat ../t.properties`
sed -i.bak 's/field=""/filed="$a"/g' data.xml
But, something doesn't work as it should.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Saboteur, 2016-12-09
@saboteur_kiev

in 1.0.0 you have dots in addition to numbers.

sed -i.bak 's/field=\"[.0-9]*\"/field="$a"/g' data.xml

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question