Find and replace in Linux text file

Status
Not open for further replies.

rfcn

Member level 2
Joined
Jun 18, 2010
Messages
42
Helped
4
Reputation
8
Reaction score
1
Trophy points
1,288
Location
China
Activity points
1,531
Hi,

I'd like to find and replace some strings in a text file in Linux. It's a condition replace. For example, if there is "X=100" in a line, then replace 111 to aaa in the line. See bellow,

111222333,X=100
111222333,Y=100
111222333,Z=100

I want a script, the script will excute the find and replace and the text will convert to:

aaa222333,X=100
111222333,Y=100
111222333,Z=100

How to rearlize the script?
Thanks!
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…