Skip to main content

Timeline for Printing unique lines

Current License: CC BY-SA 2.5

6 events
when toggle format what by license comment
Sep 9, 2020 at 13:07 comment added Gilles 'SO- stop being evil' @Chris sort | uniq -u only prints the unique lines. In other words, it removes all copies of duplicate lines. In contrast, sort -u or sort | uniq keeps a single copy of duplicate lines.
Sep 9, 2020 at 11:32 comment added Chris sort -u worked perfectly. however, sort | uniq -u was missing lines !
Jun 4, 2015 at 10:23 comment added quazgar Or even shorter awk '!seen[$0]++', since the {print} is implied by an empty command.
Mar 24, 2011 at 13:27 vote accept Šimon Tóth
Mar 23, 2011 at 3:26 comment added asoundmove how about awk '!seen[$0]++ {print}'?
Mar 22, 2011 at 23:06 history answered Gilles 'SO- stop being evil' CC BY-SA 2.5