Created
April 28, 2015 12:49
-
-
Save adsr303/450e2ed6dd8899f78757 to your computer and use it in GitHub Desktop.
Remove duplicate entries in UNIX path. Keeps the order of first occurences.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/awk -f | |
BEGIN { | |
RS = ":|\n" | |
} | |
{ | |
if (data[$0]++ == 0) | |
lines[++count] = $0 | |
} | |
END { | |
for (i=1; i<=count; i++) { | |
printf "%s", lines[i] | |
if (i < count) | |
printf ":" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment