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