I have
in 3rd line of a file. I want to replace that with
. How to do this with sed
Like this:
$ sed '3,6 s//my_dB/' file
Demo:
$ cat file
1:
2:
3:
4:
5:
6:
7:
$ sed '3,6 s//my_dB/' file
1:
2:
3: my_dB
4: my_dB
5: my_dB
6: my_dB
7:
To store the changes back to the file use the -i
option
$ sed -i '3,6 s//my_bd/' file
However you really should be using a XML parser. Getting into parsing XML with regexp
is really a bad idea.