If you are on OS-X or Linux you have a number of possibilities such as
sed that will let you specify, on the command line, what to search for and the what to display around it.
On Windows 10 you can get the same functionality within the bash shell that you can optionally install or on all versions you can install MSYS, MinGW or Cygwin all of which include grep. With grep you can use:
grep -A 3 -B 2 "pattern" wildcard
Which will find pattern and display the 2 lines Before and 3 lines After line it is on as well as the line itself in files that match the wildcard.
If you have python installed, on OS-X or Linux you almost certainly will but on Windows you would need to install python, you can then add the grin library and command line tool with
pip install grin (you may need to prefix with
sudo on some systems) to get similar functionality.
I tested grin with a big text file, (8.5 Gigabytes), and while it took a minute or four it successfully found the 2 lines that matched my target, on lines 1048577 & 9437186.