aboutsummaryrefslogtreecommitdiffstats
path: root/awklib/eg/prog/histsort.awk
blob: c2c9d1a710e18643b2199cd80e5f70e178135721 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# histsort.awk --- compact a shell history file
# Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain
# May 1993

# Thanks to Byron Rakitzis for the general idea
{
    if (data[$0]++ == 0)
        lines[++count] = $0
}

END {
    for (i = 1; i <= count; i++)
        print lines[i]
}