The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Need to replace the first word of a line if it occurs again in the next line(shell) geeko Shell Programming and Scripting 4 06-18-2009 03:36 PM
how to replace a text of line with a comment line manoj.b UNIX for Dummies Questions & Answers 6 05-21-2009 12:11 PM
Replace line number 2 with another line srilaxmi UNIX for Dummies Questions & Answers 1 03-05-2009 06:31 AM
search for a string ,replace the whole line with new line kkraja Shell Programming and Scripting 4 08-07-2008 03:26 AM
sed - Replace Line which contains the Pattern match with a new line kousikan Shell Programming and Scripting 2 03-24-2007 07:24 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 06-15-2009
ammu ammu is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 79
go to a line and replace

I have a file (say file1.txt) and I have to search for a line which has a text replace it and replace another string too in the same line.
Eg:
file1.txt
--------

x='hai' y='world' z='unix'
x='hai'
y='world'
x='hai' z='perl' y='world'

I have to go to line which has x='hai' and y='world' and replace
x='hai' to x='hello' and y='world' to y='universe' as below

modified file

x='hello' y='universe' z='unix'
x='hai'
y='world'
x='hello' z='perl' y='universe'

Can you please give me a command of shell program to do that

Thanks
Ammu
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:18 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0