Clean trailing whitespace with sed

Hi. This is just a short post; but I am still alive! :) I have recently cleaned up my neovim config, and I had the requirement for a script which cleans trailing whitespace. I have come up with some cool sed stuff. Here is my short script:

#!/bin/sed -f

:a
/^\n*$/ {
    $d
    N
    ba
}

s/[[:space:]]\+$//

Here are some links about this topic:

That's it for today!