Deleting pesky blank lines from source files

Blank lines are an eye sore for source files. During the last few weeks I’ve been shuttling php and html files from various host servers and my PC. During the whole ordeal the source files kept adding a huge number of blank lines. At one point an ‘if’ construct in one of my PHP code was about 60 lines away from the next starting brace. This was all caused by the non standard newline character, also known as a line break or end-of-line (EOL) character. As we all know, it is a special character or sequence of characters signifying the end of a line of text. Unfortunately the actual codes representing the newline differ across operating systems, which creates problems such as the above when exchanging data between systems. If you think you don’t use *nix systems and are therefore free from these problems then you are wrong. Even though you may be using Windows, most host servers are Linux based, and so transferring files back and forth from these servers can create these kind of problems.
Read More