awk/shell script that filters its input and only outputs identical lines once