Update a Propety in a Propety File

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

See Also
Unix Administrator Career Path

Have a Unix Problem
Do you have a UNIX Question?

Unix Books :-
UNIX Programming, Certification, System Administration, Performance Tuning Reference Books

Return to : - Unix System Administration Hints and Tips

(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
All product names are trademarks of their respective companies.
The site www.gotothings.com is in no way affiliated with or endorsed by any company listed at this site.
Any unauthorised copying or mirroring is prohibited.