How much RAM is the program allowed to use? Is it for instance allowed to store the whole file in memory?
Is it OK to create a second file (an index file)?
The *quickest* way will be to read the whole file into memory, sort it then do a binary search on the data. But if you can't do that due to memory limitations then we need to find another way. 3000 elements * 300 characters (worst case) =900,000 bytes, which on a modern machine with 3GB of RAM really isn't that much.
A hash file is another way; this takes a hash of each item in the table (which is a value calculated from it, for example a simple hash is just to add up all the ASCII codes of the letters in the string, so "hello"=104+101+108+108+111=532, so you might store in a new file the hash plus each line that hash occurs on - let's say lines 10,30,70 and 100 have a hash of 532, you could store "532 10 30 70 100" on a line, then when you want to search for a string, first calculate its hash, then lookup that value in the hash file, then you can check each of the listed line numbers for a match (i.e. 10 30 70 100), which will be a lot quicker than scanning the whole file. Ideally a hash will be unique, but this may be "good enough" for what you want.