First the bad news: It doesn't look like there is a way to click an HTML link to open a specific line number in a .txt file in an editor.
However, there is a way to do this if your results can be HTML files instead of .txt files. In that case, you could put each line of your results (let's call the file results.html
in its own tag each with its line number as its id, e.g.:
<p id="1">Result 1</p>
<p id="2">Result 2</p>
<p id="3">Result 3</p>
Then, in your main HTML file with the links, you could link to each id in the file like this:
<a href="/username/directory/results.html#1">Link to Line 1</a>
<a href="/username/directory/results.html#2">Link to Line 2</a>
<a href="/username/directory/results.html#3">Link to Line 3</a>
The downside of this is that you can't edit the results like you can in an editor. If editing the results is a must, you could add the contenteditable
flag to the results to make them editable in the browser. Then, to approximate saving, you could write a javascript function to either copy the edited text to their clipboard, or figure out a way to download it (this SO question looks like a promising resource for that.)
I know that this probably wasn't the answer that you were hoping for, but hopefully it'll help.