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
  • Related: vi.stackexchange.com/q/6269/4676 Commented Jan 28, 2016 at 20:11
  • @don_crissti, interesting addition; thanks! I would probably opt for the longer but equivalent sed '1{h;n;};G;/^\(.*\)\n\1$/d;P;d' input; somehow it's easier for me to read. :) Commented Nov 8, 2016 at 2:16
  • Also related: unix.stackexchange.com/a/417736/135943 Commented Jan 17, 2018 at 10:16