replacing a string

General support questions
Post Reply
knzzz
Posts: 157
Joined: 2017/02/25 12:41:42

replacing a string

Post by knzzz » 2018/03/14 02:58:37

Hi Team,

i want to replace a string in a file using shell script

for eg:

cat test.xml

This is the file which is used
to show the how to
change a single word in a file
using shell script

-----------------------------------------------------

in the above test.xml file i want to replace the word with script with automate with

can some one help me out.

Regards
Kanna

hunter86_bg
Posts: 2019
Joined: 2015/02/17 15:14:33
Location: Bulgaria
Contact:

Re: replacing a string

Post by hunter86_bg » 2018/03/14 04:52:22

Maybe a oneliner will help (make a backup of the file while testing):

Code: Select all

sed -i'.bkp' 's/some\ strange\ \$tring/replacement\ string/g' /path/to/file/to/be/modified

Post Reply