Remove trailing whitespace and "print url" lines.