in reply to remove single blank lines?
If the file you want to examine does not fit in memory, you will have to remember two lines at a time.
update: This doesn't quite work. We'll have to deter deciding whether or not we will print the current line until we have examined the next line.while (<>) { print unless ($_ eq "\n") && ($last ne "\n") && ($secondlast ne "\n" +); $secondlast = $last; $last = $_; }
while (<>) { $last = $this; $this = $next; $next = $_; print $this unless ($last ne "\n") && ($this eq "\n") && ($next ne " +\n"); } print $next unless ($next eq "\n") && ($this ne "\n"); #last line is s +pecial
In Section
Seekers of Perl Wisdom