code_junkie

How To Removing Trailing Whitespace Of All Files Recursively?

Nov 11th, 2011
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. find dir -type f -print0 | xargs -0 sed -i .bak -E "s/[[:space:]]*$//"
  2.  
  3. find dir -not -path '.git' -iname '*.py'
  4.  
  5. find . -print0 |xargs -0 perl -pi.bak 's/ +$//'
  6.  
  7. find . -print0 |xargs -0 perl -pi 's/ +$//'
  8.  
  9. perl -pi 's/ +$//' **/*
  10.  
  11. sed -i '' 's/[[:space:]]*$//g' **/*.*
  12.  
  13. find . -not ( -name .svn -prune -o -name .git -prune ) -type f
  14. -exec sed -i 's/ *$//' {} ;
  15. -exec sed -i 's/rn$/n/' {} ;
Add Comment
Please, Sign In to add comment