On Wed, Oct 26, 2011 at 4:07 AM, James Rankin <kz2...@googlemail.com> wrote:
> type textfile.txt | find /c "OK"

  In the Unix world, we have something called "useless use of cat".  I
guess in the NT world, we have "useless use of TYPE".  :-)

  FIND can accept a filename as an argument.  There's no need to
invoke TYPE and pipe the output.

        FIND /C "OK" textfile.txt

  If something can only read standard input, you're better off using
input redirection, e.g.:

        FIND /C "OK" < textfile.txt

Or, if you prefer your input file first on the command line:

        < textfile.txt FIND /V /C "OK"

  Invoking TYPE and piping means a buffer or temporary file is
allocated, the input file is spooled into that, and then the buffer is
fed into the next program.  In a small file it doesn't really matter,
but on a big file it's rather inefficient.  Giving a file argument, or
re-assigning standard input, means the file is just read.  :)

-- Ben

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

---
To manage subscriptions click here: 
http://lyris.sunbelt-software.com/read/my_forums/
or send an email to listmana...@lyris.sunbeltsoftware.com
with the body: unsubscribe ntsysadmin

Reply via email to