SyntaxFix
Write A Post
Hire A Developer
Questions
Much simpler to my opinion:
sed -r 's/\s+//g' filename