Results 1 to 4 of 4
hi all,
i am trying small shell script, i need to replace string "/usr/local" with "/root", this pattern may occurs more then one and i need to replace all,
i ...
- 03-27-2009 #1Just Joined!
- Join Date
- Mar 2009
- Posts
- 7
string replacement,
hi all,
i am trying small shell script, i need to replace string "/usr/local" with "/root", this pattern may occurs more then one and i need to replace all,
i am unable to do it using 'sed'
please help me..
thank u
- 03-27-2009 #2Linux Enthusiast
- Join Date
- Aug 2006
- Location
- Portsmouth, UK
- Posts
- 539
Have you tried using perl ?
Will dump <file> to stdout with any changes the regex makesCode:perl -pe "s/\/usr\/local/\/root/g" <file>
Will make the changes directly in <file>Code:perl -i -pe "s/\/usr\/local/\/root/g" <file>
RHCE #100-015-395
Please don't PM me with questions as no reply may offend, that's what the forums are for.
- 03-27-2009 #3Just Joined!
- Join Date
- Mar 2009
- Posts
- 7
matonb thank you, i tried second one that is working fine, thanks agian
- 03-27-2009 #4Linux Enthusiast
- Join Date
- Aug 2006
- Location
- Portsmouth, UK
- Posts
- 539
No problem
RHCE #100-015-395
Please don't PM me with questions as no reply may offend, that's what the forums are for.


Reply With Quote