in reply to how to split based on new line or others ?

Could be this?!
perl -F: -nae 'next if /^#|^$/;chomp$F[1];print "<$F[0]>$F[1]</$F[0]>\ +n"' file