My xml file looks like this:
<price = "2.22"><instock = "1">
I need to have it like that:
<price = "2.22">
<instock = "1">
After each ">" character I need to put a newline character with awk or sed. How can i accomplish that? thank you
|
As KeithB said, there are potential problems that can arise from using a crude approach. However, this crude approach is a tiny bit more selective so that chances it will fail are reduced by about 0.00001% which may be enough.
If there may be whitespace between the angle brackets, then this may be better:
which will eliminate that whitespace. |
|||
|
|
|
If you want to do this right, you need something more powerful than awk. One of the problems is awk won't handle A quick and dirty awk script is
This treats |
|||
|
|
<price = "2.22">is valid XML. – grawity Sep 20 '10 at 17:19