in reply to Fast way to read from file
perl -e'open(FL,"primes.txt");$. == 10000 && ($line = $_) while <FL>;print("$line\n");'
it takes < 1 sec. to find the 10,000th line and uses very few memory.