#! perl -lw
while(<>){
    chomp;
    if(/^AFD/){
        push@lines,$_;
        last;
    }}
die unless @lines;
while(<>){
    chomp;
    if(/(.*?)\s*\&\&\s*$/){
        #sometimes && is at the end of a line with text
        if($1 ne ""){
            push@lines,$_;
        }
        last;
    }
    push@lines,$_;
}
while($lines[$#lines] eq ''){
    pop@lines;
}
for(@lines){
    print;
}
