Skip to content

Instantly share code, notes, and snippets.

@gilgamez
Created December 17, 2013 11:01
Show Gist options
  • Save gilgamez/8003220 to your computer and use it in GitHub Desktop.
Save gilgamez/8003220 to your computer and use it in GitHub Desktop.
awk/shell script that filters its input and only outputs identical lines once
#!/bin/sh
IN=${1:--}
OUT=${2:-/dev/tty}
# see http://stackoverflow.com/questions/11532157/unix-removing-duplicate-lines-without-sorting#11532197
awk '!x[$0]++' $IN >$OUT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment