How can I update a property in a property file? I am using
cat com/ams/einterfaces/custom/hutchison3guk/config/salesforceupload/SalesForceUploadTest.properties
| sed "s@salesforcefile=*@salesforcefile=/opt/AMS/eINcent/live/in/$1@g"
> com/ams/einterfaces/custom/hutchison3guk/config/salesforceupload/SalesForceUploadTest1.properties
It is not replacing the value but appending to the existing value.
----->
Try this
sed "s@salesforcefile=.*@salesforcefile=/opt/AMS/eINcent/live/in/$1@g"
----->
Excellent.
It worked fine.
Is any way to write on to the same file.
When i am writing on to the same file SalesForceUploadTest the file
is becoming zero.
----->
If I am trying to copy or move i am using the following
mv SalesForceUploadTest1.properties SalesForceUploadTest.properties
cp SalesForceUploadTest1.properties SalesForceUploadTest.properties
but I am getting the following error
mv: cannot access SalesForceUploadTest1.properties
cp: cannot access SalesForceUploadTest1.properties
----->
You can write to the same file with perl :
perl -p -i -e "s@salesforcefile=.*@salesforcefile=/opt/AMS/eINcent/live/in/$1@g"
file
Quick Links:
Do you have
a UNIX Question?
Unix Home: Unix System Administration
Hints and Tips