No, you've merely hidden the opening of the file down inside an external utility. The file is still being opened and completely read, you've just managed to introduce a layer of indirection and a fork/exec overhead.
In order to count the number of lines in a file something is going to have to open the file and search through it for end-of-line markers. That is what he meant when said impossible.
(Of course if you were dealing with a file that used fixed-length lines that still were newline terminated you could cheat and do it with stat and /, but for all normal intents and purposes "impossible" is still a reasonable pronouncement. :)
We're looking for a Perl and Database Developer for Corporate Investments Group.
In reply to Re^6: system command
by Fletch
in thread system command
by megaurav2002
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |