-1

I have really big text file, it is really a lot of text. I try to read it, but it is too much text.

I want to find some word, number, value in that file. I search but can't find the software that I need. i don't have time to read and find what I want in that file. How about, have a software, input a big text file, then select or extract specific value from this file. Please help. Thank-you.

  • 1
    Please define a) how big the text file is. There are several solutions for 10 MB files, but maybe just a few for 10 GB files. b) which operating system do you use c) what your budget is d) what does "exact same value" mean? Identical to what? What is the source for that value? Also a text file? Or user input? – Thomas Weller Apr 5 '17 at 15:40
  • Could you please use grammatical English. Capital letters to start sentences. This isn't a text message. – Eric Shain May 6 '17 at 13:23
2

If you are on OS-X or Linux you have a number of possibilities such as grep or 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.