![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
| Replacement of string | c0384 | Shell Programming and Scripting | 1 | 09-17-2008 11:06 AM |
| AWK String replacement | subin_bala | Shell Programming and Scripting | 5 | 07-16-2008 03:29 AM |
| String Replacement Script | jbud | Shell Programming and Scripting | 6 | 11-15-2007 06:37 AM |
| String Replacement with Perl | Lindarella | Shell Programming and Scripting | 4 | 09-29-2006 03:05 PM |
| sed problem - replacement string should be same length as matching string. | amangeles | Shell Programming and Scripting | 4 | 01-11-2006 06:11 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
String replacement
Hi I am new to shell scripting but i manage to do some simple things.
I am trying to replace a string in one file. I am using sed to replace but it is not permanently writing to the file, rather it is temporary. I want to know whether is there any another method to replace a string in a file permenantly. THIS IS WHAT I HAVE DONE: ===================== $ cat conf.txt This is first line which contains NO This is second line which contains NO This is thrid line which contains NO I used sed to replace NO with YES in 2nd line. $cat -n conf.txt | grep 2 | sed 's/NO/YES/g' 2 This is second line which contains YES But i want this to happen in the file. I want the replacement to be happened in file(2nd line though). Please guide me regarding the same and correct me if iam wrong. ![]() Thanks in advance. ss |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|