``` sed 's/[ \t]*$//' file.txt ``` for ``` cat -e test.txt bla bla t $ ``` will remove "t" character ``` sed "s/[[:space:]]*$//" test.txt | cat -e ``` works correctly