I was thinking to create a history file for my utility written in bash. This file is a record of recent server addresses. I will append new addresses to it (one line each time) but I don't want duplicates.

So if the file now is:

```
dept4.abc.edu
dept3.abc.edu
dept2.abc.edu
dept1.abc.edu

```

Now, if I am going to append a `dept3.abc.edu` to the end, I don't want it to be,

```
dept4.abc.edu
dept3.abc.edu
dept2.abc.edu
dept1.abc.edu
dept3.abc.edu

```

Instead, I hope it to be,

```
dept4.abc.edu
dept2.abc.edu
dept1.abc.edu
dept3.abc.edu

```

`sort file | uniq` does not work in this situation, because I want keep the newest server address in the end. Any ideas?