I have a file whose contents are like this :
control_data {
some data dadadadf
some data fsfsfs
some more data
.
.
.
}
more data below
{
.
.
}
I want to delete the data from “control_data” to the first “}”
I tried a command
sed "s/control_data\([^}]*\)}//g"
but this only works if we do not have multiple lines eg. this command works when we have data like:
control_data {some data dadadadf some data fsfsfs some more data...}more data
It gives :
more data {....}
How to make this command work when we have data across multiple lines ?
I am new to shell scripting some explanation with answer will go a long way in helping.
Thanks in advance.
This one may not be an ideal one but this used sed(your sed code)
Logic: I am converting all new lines to : and then using your sed code and then converting all : to newlines
Note : My assumption is : wont be present in the file anywhere.