different options in sed
Hi all,
I use sed to do basic string replace options in files.But i have a doubt. Consider i have a path like this inside a file. /home/dinesh/scripts And i need to replace this with /var/tmp/scripts. I tried this with sed but failed all the time.Can any one help me to get this working through "sed". Thanksin advance, Dinesh. |
How about showing us the actual command(s) you tried, so we can point out where you went wrong?
The most likely culprit however, is that the slashes in the text conflict with the slashes in sed's substitution command. This is easily fixed, just by using a different delimiter (you could also backslash-escape them, but why bother?). Code:
sed 's|/home/dinesh/scripts|/var/tmp/scripts|' http://www.grymoire.com/Unix/Sed.html http://sed.sourceforge.net/sedfaq.html http://sed.sourceforge.net/sed1line.txt |
Hi,
As you suugested it worked after executing this, sed -i 's|/home/dinesh/scripts|/var/tmp/scripts/|'g file Thanks. |
Quote:
:) |
All times are GMT -5. The time now is 01:46 AM. |