Just loop over the file looking for a line with only whitespace
open(IN_FH,"<input.txt");
open(OUT_FH,"<output.txt");
while (<IN_FH>)
{
if ( $_ =~ /^\s+$/)
{
next; # line only has white space, such as tabs
}
else
{
print(OUT_FH $_);
}
}
close(IN_FH);
close(OUT_FH);
Main Topics
Browse All Topics





by: ozoPosted on 2009-10-01 at 05:36:38ID: 25467971
perl -i.bak -ne "print if /\S/" file