#!/usr/bin/env awk -f
#
# ddup - skip duplicate lines (without requiring sorted input)
#
# usage:
#   ddup FILE1 [FILE2 ...]
#   ddup < FILE
#   program | ddup
#
# removes duplicate lines from the input without requiring it to be sorted.
# because it caches each unique line, this is less efficient than using sort(1)
# and then uniq(1), but necessary if maintaining the order is desirable.

$0 in seen { next }
length($0) {
    seen[$0] = 1
    print
}
