I have a file that looks something like this:
for (i = 0; i < 100; i++) for (i = 0; i < 100; i++) for (i = 0; i < 100; i++) for (i = 0;
This Perl code edits your original file:
perl -i -ne 's/^\s+//;print' file
The next one makes a backup copy before editing the original file:
perl -i.bak -ne 's/^\s+//;print' file
Notice that Perl borrows heavily from sed (and AWK).