[NTLUG:Discuss] in a world where grep doesn't have the -m (match) option..

Chris Cox cjcox at acm.org
Tue Mar 25 17:03:36 CDT 2008


Richard wrote:
> Chris Cox wrote:
>> Richard wrote:
>>   
>>> ..how would one go about stopping a grep after the first match? <snippage>
>> <snippage>
>>
>> grep 'whatever' file | head -1
>> (that's a minus one)
>>   
> AH YES!!  That's brilliant!   It would cause the search to continue..but 
> WOULD get the job done.  Thanks Chris!
> 

Shouldn't continue.  Should terminate after a full buffer containing
the matched string goes to the head command.



More information about the Discuss mailing list