I have a log which contains XML lines. Sample format below:<head>    <body>        <line>asdasd</line>    </body></head>I want to scan the log file and append the lines that do not start with '<' to the previous line. Output would be like below:<head>    <body>        <line>asdasd</line>    </body></head>Thanks
How to append a line that does not start with '
text processing;sed;regular expression;perl;xml
Perl to the rescue!perl -pe 'print \n if /^\s*+</; chomp;' input > outputi.e. newline is removed from each line, and it's printed when the next line starts with whitespace followed by a <.To keep the final newline, change chomp to chomp unless eof or add END { print \n }