Home > linux > How To: Remove trailing spaces at the end of a line

How To: Remove trailing spaces at the end of a line

To delete trailing spaces at the end of a line…

To do it against a single file do:

$ sed 's/[ \t]*$//' file.orig > file.out

To do all files in current directory do:

$ for i in `ls -l | awk '{print $9}'`; do sed 's/[ \t]*$//' $i > $i.out; done
Categories: linux Tags:
  1. No comments yet.
  1. No trackbacks yet.