-1

I'm using linux buildroot os disto 2020.02. and I have a conf file formated like so:

[section1]
key1 = val1
ke2 = val2

[section2]
key1 = val1
ke2 = val2

I would like to add the line "key3 = val3" to section1, it's important to add it after all the existing lines in the section, how can I do it?

I am also need to delete this line after.

matz_ch
  • 29
  • 6

1 Answers1

0

Try this command : :g/ke2/ +1 s/$/key3 = val3/ | +1,$ d

Farhad Sarvari
  • 1,051
  • 7
  • 13