[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Quit after finding first N files
From: |
James Youngman |
Subject: |
Re: Quit after finding first N files |
Date: |
Fri, 5 Mar 2010 10:23:34 +0000 |
On Fri, Mar 5, 2010 at 10:13 AM, Nexor <address@hidden> wrote:
> Hi James,
Netiquette point: please don't reply directly, if you keep your reply
on the mailing list, others can benefit.
> Thank you so much for the detailed response. I didn't know I can
> simply use 'head' to get what I need.
There is a difference between the two approaches. Writing through
a pipe to "head -8" will kill the writer when the 9th result is
printed. If the cost of finding an additional match is significant
(or only N matches exist) then there is a potential waste of resources
involved in finding the extra match. For most uses this is not a big
deal and the approach using "head" works just fine.
James.