I have a text file that has at some point a text like this:
[....previous text...]
#[ID1]
#my_url="http://miccheck12.com"
#your_url="http://miccheck12.com"
#comments=""
[....subsequent text...]
The block of text I’m interested in is identified by ID1
. For all the block I want to remove the prepending character #
.
I was trying to do this with sed
. Given that for example sed -i 's/#[ID1]/[ID1]/g' file.txt
works successfully, I’ve tried to extend this to the next line like: sed -i 's/#[ID1]n#my_url/[ID1]/g' file.txt
but it’s not catching the lines anymore. How can I solve this? I’m not even sure sed
is the best approach.