strip comments and trailing whitespace from input files