Also, the Linux/Unix command egrep -v can do this directly, without programming. The -v modifier tells it to produce the lines which do not match the specified regex. Simply direct the output to another file, check that it has what you want, and rename it to replace the existing file.
egrep '^\s+' -v myfile > myfile_edited
Windows powershell has similarly elegant solutions that avoid the need for programming.