in reply to Re: fast lookups in files
in thread fast lookups in files

...but I'm not sure if it works with numerically sorted lines.
Then make a processed copy of the file, where you pad the numbers to the right to a fixed length, with sprintf, so they sort the same numerically and asciibetically.

Replies are listed 'Best First'.
Re^3: fast lookups in files
by moritz (Cardinal) on Feb 05, 2008 at 13:25 UTC
    Right, but again it requires the size of the index to be known in advance - in which case you can use the binary data much more efficient.
      If you plan to store the numbers as binary data in the file: note that positive big endian integers also sort properly asciibetically. Use the "N" template for pack.