I don't want to delete the empty lines completely, but I want to remove the trailing tabs and whitespaces in them. Eclipse usually does it (through a preference setting) when we save the file.
For example, the file before saving ($ = end of line):
def shuffle(list):$ import random $ $ random.shuffle(list) $ $
… and when I save this in the editor, Eclipse does the following:
def shuffle(list):$ import random$ $ random.shuffle(list) $ $
How can I automatically trim trailing whitespace with Notepad++?
You should be able to do a regular expression find/replace in Notepad++ using a pattern like
There are also a few options under menu Edit -> Blank Operations that may fit your needs.
Under the "Macro" menu there's an option for "Trim trailing and save". If you need to do a regular expression it may be possible to create a macro however I've never tried them.