Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • Have you tried grep --mmap ... already? Real programmers would do that with vim -R -b 400gbfile and then /pattern. Commented Aug 13, 2015 at 20:52
  • @ott your vim answer piqued my interest. Does vim really only load what it needs into memory? A quick internet search is not conclusive. Some people say it still has a hard time with large files. Others say "Ctrl-c" will stop it trying to load everything into RAM. So I'm not sure whether your answer is correct. Commented Aug 13, 2015 at 21:49
  • @ott-- Real programmers would do it in Fortran. Commented Aug 13, 2015 at 22:13
  • Maybe this could work grep --only-matching --byte-offset --binary. The --only-matching option can be implemented without buffering the whole line, but I don't know if your implementation does take advantage of this to actually save memory. --byte-offset will indicate where the matching sequence starts in the binary data stream or blob. Commented Oct 12, 2021 at 13:19
  • @ott-- The OP is using Linux so there's no --mmap at all. It's an option in BSD grep Commented Oct 16, 2023 at 5:06