Remove adjacent duplicate lines while keeping the order
uniq
will do this for you:
$ uniq inputfile
Golgb1
Akna
Spata20
Golgb1
Akna
Awk
solution:
awk '$1 != name{ print }{ name = $1 }' file.txt
The output:
Golgb1
Akna
Spata20
Golgb1
Akna
Try this - save the previous line and compare against current line
$ perl -ne 'print if $p ne $_; $p=$_' ip.txt
Golgb1
Akna
Spata20
Golgb1
Akna
You've tagged uniq
as well - did you try it?
$ uniq ip.txt
Golgb1
Akna
Spata20
Golgb1
Akna