BEGIN { line=0; } NR > 47 { line++; print # if (line < 40) { # break # } }