I certainly wouldn't recommend the first solution as, although it looks nice, it will read the entire contents of the file(s) into memory before spitting out the first 5 lines. Better to not even read the 6th line (as demonstrated in other items in this thread), much less allocate memory for it. (:
- tye (but my friends call me "Tye")In reply to (tye)Re: how to print first 5 lines of a file
by tye
in thread how to print first 5 lines of a file
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |