The following two sed commands works.
sed -E "s#Example(.*)#\nconst ex='Example\1';\n#; s#Input:(.*)#const\1;#" in.txt | sed '/\S/!d'
However, how to rewrite them so that only one sed command is used? i.e.
sed -E "???" in.txt
I tried this but it did not work:
sed -E "s#Example(.*)#\nconst ex='Example\1';\n#; s#Input:(.*)#const\1;#; /\S/!d" in.txt
in.txt:
Example 1:
Input: s = "()"
GNU sed version is 4.7.
Expected output:
const ex='Example 1:';
const s = "()";
AnotherExample Input "10"?