I have a minor problem. I want to replace a character/single string between two strings but would like to leave the strings themselves "unharmed" by using sed.
The input is:
<hello> <world>
My desired output:
<hello>
<world>
My first attempt:
echo "<hello> <world>" | sed 's/>.</\n/g'
The output of it:
<hello
world>
As you can see, the ">" from "" and the "<" from "" have been removed by using my line above.
How do I prevent it from doing so?
echo "<hello> <world>" | sed -E 's/(\W) (\W)/\1\n\2/g'