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*

2
  • I found two caveats: if the target file is empty it copies nothing (instead it should copy all the lines). Then I tried to put inside a valid line, but it copied all of them, not only the next ones. Commented Nov 30, 2020 at 12:51
  • @Mark well yes. You wanted to specifically avoid duplicates. There's no point in running this if you don't have duplicates. If the file is empty, just run grep myentry /var/log/syslog. I don't understand the second point. Please add an example to your question. I used the data you gave and it worked as expected. Commented Nov 30, 2020 at 13:10