Walter Harms wrote, quoting Ralph Corderoy:
>> ... if you've a grep that produces
>> 1E6 lines and you just want to read the first then pipe it into
>> `sed 1q' before reading it into awk so the grep gets a SIGPIPE on
>> writing to the finished sed, curtailing its largess.
>
> To access head or tail of a ascii file the 'head' and 'tail' commands
> are what you are looking at (prevents reading the whole file just to
> get the result).

And if the one line you are looking for is somewhere between 1E5 and 2E5,
in the 1E6 lines of the original stream?

   ... | grep pattern | sed 1q

will get the first line which matches pattern, regardless of where it
appears in the stream, which I think, is what Ralph said.

Regards,
Keith.


_______________________________________________
Groff mailing list
Groff@gnu.org
http://lists.gnu.org/mailman/listinfo/groff

Reply via email to