Input file contains more than 1 newlines, empty tags as follows:
<html>
<body>
<title>XXX</title>
<p>text...</p>
<collaboration seq="">
<ce:text></ce:text>
</collaboration>
...
<p>text</p>
<collaboration seq="">
<ce:text>AAA</ce:text>
</collaboration>
<p>text</p>
</body>
</html>
Output file needed with only one newline characters, empty tags must be removed
<html>
<body>
<title>XXX</title>
<p>text...</p>
...
<p>text</p>
<p>text</p>
<collaboration seq="">
<ce:text>AAA</ce:text>
</collaboration>
</body>
</html>
Coding which in have tried:
print "Enter the file name without extension: ";
chomp($filename=<STDIN>);
open(RED,"$filename.txt") || die "Could not open TXT file";
open(WRIT,">$filename.html");
while(<RED>)
{
#process in file
s/<collaboration seq="">\n<ce:text><\/ce:text>\n<\/collaboration>//g;
s/\n\n//g;
print WRIT $_;
}
close(RED);
close(WRIT);
Above coding doesn't clears anything which is needed... How to solve this?