Page 1 of 1

How to replace one string to another string by using unix

Posted: Sat Jul 27, 2013 10:05 am
by A_SUSHMA
Hi..,

I want to replace one string to another string by using unix

1.by using vi editor
2.with out using vi editor

for ex:
I/p is like
---------------
sushma is reading books,sushma is watching movie,sushma is cooking....

o/p is:
---------
bargavi is reading books,bargavi is watching movie,bargavi is cooking.


i want

Posted: Sat Jul 27, 2013 11:43 am
by jerome_rajan
1. Using vi editor
A. :s/search_string/replacement_string/g

2. Without using vi editor.
A. sed s/search_string/replacement_string/g <filename>

Posted: Sat Jul 27, 2013 3:22 pm
by prasson_ibm
1. Using vi editor

Code: Select all

s1,$/sushma/bargavi/g 
2. Without using vi editor.

Code: Select all

sed 's/sushma/bargavi/g' <Input file Name > Output file Name