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*

3
  • 4
    If you're doing this with huge files, then the memory constraints of loading a huge file into an associative array are going to be prohibitive. Commented Jun 17, 2016 at 14:01
  • @CharlesDuffy, that would be a lot worse with grep -Fvxf approach though, where the performance would be unacceptable long before memory exhaustion. Commented Jan 20, 2024 at 12:29
  • @StéphaneChazelas, indeed; for really large files one really ought to use sort+comm, where better sort implementations' ability to generate temporary files and merge-sort them together means that memory constraints are moot. (Of course, keeping content pre-sorted to the extent possible is in this context a Very Good Idea) Commented Jan 20, 2024 at 17:57