Remove trailing spaces at the end of each line in a file

How to remove trailing spaces at the end of each line in a file on Linux?

Use this script with sed:

cat your_file | sed 's/[[:blank:]]+$//g'
Leave a Reply

Your email address will not be published. Required fields are marked *