I want to do this substitution in a set of files :

replace :

```
KEY
KEY1|VAL1
KEY
KEY2|VAL2

```

by :

```
KEY
KEY1|VAL1

```

Eg :

```
KEY
KEY|sde
KEY
KEY|45g

```

by

```
KEY
KEY|sde

```

In short, I need to remove the second occurence of KEY \n KEY|VAL pair. I am not good at using sed.