Date: 13 Aug 2010 18:51:46 -0000 From: John Levine <johnl@iecc.com> To: freebsd-questions@freebsd.org Cc: j.mckeown@ru.ac.za Subject: Re: Grepping a list of words Message-ID: <20100813185146.2645.qmail@joyce.lan> In-Reply-To: <201008131601.34182.j.mckeown@ru.ac.za>
next in thread | previous in thread | raw e-mail | index | archive | help
>> Since I will have a need to run this check frequently, any suggestions for >> a better approach are welcome. > >sort -u and comm(1)? sort is O(N log N) while grep is O(N) Which is faster depends on the constant factors in each, but as the data sets get bigger, the log N term will dominate. That is, for small sets of data, I don't know which will be faster, but either will be fast enough so who cares. For large sets of data, the sort will be slow. R's, John
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100813185146.2645.qmail>