2009/2/20 Scott Michel <span dir="ltr"><<a href="mailto:scottm@aero.org">scottm@aero.org</a>></span><br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">On Feb 20, 2009, at 12:45 PM, Misha Brukman wrote:<br>
I've got a fairly simple perl script that trims trailing whitespace [...]</div></blockquote><div><br>% cat llvm/utils/lint/remove_trailing_whitespace.sh<br>#!/bin/sh<br># Deletes trailing whitespace in-place in the passed-in files.<br>
# Sample syntax:<br># $0 *.cpp<br><br>perl -pi -e 's/\s+$/\n/' $*<br><br>Yep, it's a one-liner.<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
[...] and it's remarkably effective. It even works over recursive<br>
directories (not hard to do, but it's the way to do this globally.)</blockquote><div><br>With recursion into subdirectories:<br>
<br>
% remove_trailing_whitespace.sh `find . -name \*\.h`<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I'm sure it's not too much of a stretch to translate tabs to spaces,<br>
although that's controversial.</blockquote><div><br>Good point, I should add a verifier to the lint tool to check for tabs in non-Makefiles.<br></div></div>