Your description doesn't match your output, so I am a bit confused. Based on your description, the expected output should be:
```
818522;"Joey";
817399;"Ron";
817400;
818000;"ODC";
```
You wouldn't print any of the `890021` lines because they are last, so they will never have a different first field than the next line. If this is indeed what you want, you can do this:
```
$ awk -F';' '{
if($1!=last && prevLine){ print prevLine }
{ last=$1; prevLine=$0 }
}' file
818522;"Joey";
817399;"Ron";
817400;
818000;"ODC";
```
If you also want to add an exception for the last bunch of lines, try something like this:
```
$ awk -F';' '{
if($1!=last && prevLine){
print prevLine;
lastPrinted=last
}
{
last=$1;
prevLine=$0
}
}
END{
if($1 != lastPrinted){ print }
}' file
818522;"Joey";
817399;"Ron";
817400;
818000;"ODC";
890021;"monica"
```