small uniq trick

Christos Ricudis ricudis at itc.auth.gr
Mon Jan 28 01:18:45 EET 2008


Otan exete ena pelwrio arxeio ths morfhs

a
a
a
b
c
c
c
b
b
b
a
c
b
c
a


kai 8elete na kanete kati san

cat lala.koko | sort | uniq

sas symferei perissotero na kanete

cat lala.koko | uniq | sort | uniq

H prwth uniq 8a kopsei ta repetitions sto arxiko arxeio, elafrynontas 
kata poly to baros ths sort prin to teliko uniq.

test runs (nai, giwrgo, einai epaneilhmmena runs) :

$ time cat datafile | cut -f2- -d: | uniq | sort | uniq > /dev/null

real    0m1.164s
user    0m0.712s
sys     0m0.429s

$ time cat worstcase | cut -f2- -d: |  sort | uniq > /dev/null

real    0m2.522s
user    0m1.672s
sys     0m0.782s




More information about the Linux-greek-users mailing list