in reply to Re: searching a file
in thread searching a file

If you find yourself doing a grep inside a loop you essentially have an inefficient solution as you have one loop inside another (n*n) Paying the one off price to genreate a hash lookup table (or better still storing your data in this form) makes for far greater efficiency. An alternative in some instances is to build and compile a matching regex (outside the loop!) and use this in place of the grep/inner loop.

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print