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.

7
  • 1
    Is the data in a well-known format, such as XML, JSON, YAML, or a similar format? It would be nice to see real data, as we could otherwise just assume that the lines matching REMOVE should be removed, to simplify the problem. Commented Aug 6 at 6:18
  • Shall every single line from the pattern file be removed or only consecutive lines which are the same as the whole pattern file? Commented Aug 6 at 7:08
  • 2
    And what part of this is giving you trouble? Please show us what you have so far so we don't waste your time with approaches you have already tried. Commented Aug 6 at 9:13
  • 2
    Never just use the word "pattern" when discussing pattern matching. There is a major distinction between whether the "pattern" should be treated as a literal string or a regular expression (and how it's delimited). See how-do-i-find-the-text-that-matches-a-pattern for details on the issue and then edit your question to tell us if your "pattern" is to be treated as a regexp or literal, whether full-line or partial line matching is desired, etc, Commented Aug 6 at 12:13
  • 2
    Regarding "Another requirement is to remove all but leave the first occurrence only." - don't ask for help with 2 problems in 1 question. Get an answer to the first problem, then try to solve the second problem yourself given that, then ask a new question if you can't solve it yourself. Commented Aug 6 at 12:26