I have this file which is a Linux Device Tree:
# Other content
...
&uart3 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_uart3>;
status = "okay";
};
# Other content
...
At first I wanted to extract lines between &uart3 and }; which is the UART3 node, with sed:
sed -n '/^&uart3/,${p;/^};/q}' uart3.dts
Output is:
&uart3 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_uart3>;
status = "okay";
};
My problem, is how to remove all lines between &uart3 and }; , or is there a way to replace them with other content.
I read the awk solution about detecting a match and raising certain flag here.
But I don't understand how to achieve this.
I'm not parsing the Device Tree here so no need for dtc library,
I'm handling the file as a text file only.
Since this gonna be ran into a Yocto recipe, the solution can be in Python as well.
