How to replace one string to another string by using unix

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
A_SUSHMA
Participant
Posts: 43
Joined: Fri Apr 12, 2013 10:34 am

How to replace one string to another string by using unix

Post 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
jerome_rajan
Premium Member
Premium Member
Posts: 376
Joined: Sat Jan 07, 2012 12:25 pm
Location: Piscataway

Post 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>
Jerome
Data Integration Consultant at AWS
Connect With Me On LinkedIn

Life is really simple, but we insist on making it complicated.
prasson_ibm
Premium Member
Premium Member
Posts: 536
Joined: Thu Oct 11, 2007 1:48 am
Location: Bangalore

Post 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
Post Reply