Bash: find files with trailing spaces at the end of the lines

ziiweb picture ziiweb · Jun 26, 2012 · Viewed 25.8k times · Source

I'm looking for a bash command to find files with trailing spaces at the end of each line. I'm not interested in removing the spaces, but just in finding the files.

Answer

pizza picture pizza · Jun 26, 2012

Find files that has trailing spaces.

find . -type f -exec egrep -l " +$" {} \;