On Friday 15 August 2008 05:27 in
<ddb467af0808142127x7bb9aff9re9a362ad5e264a80 at mail.gmail.com>, Emen Zhao
wrote:
> Hello Marcus,
>> Try if this helps. It assumes all elements are missing ending tag, and
> doesn't support embedded tags. If that's the case, a more sophisticated
> script might be needed.
>> perl -0777 -wpl -e 's{(<(\w+).*?>.*?)(?=\s*(<\w|\z))}{$1. " </$2>"}esg'
>> Hope this helps.
It does, it _almost_ does what I need. It doesn't seem to handle the case
where the tag content starts on a new line though:
<third>
hello
<third>hello
becomes
<third> </third>
hello
<third>hello </third>
I tried undef $/ (as per a different post) but that doesn't seem to help
either. Any ideas how to fix this?
Marcus.
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!