The most common problem found with line termination is the appearance of ^M characters at the end of lines in text files that were built on Windows systems. You will find the ^M characters when they are transferred from one system to another using scp or ftp in binary mode instead of ASCII mode. The easiest fix on AIX and Linux is to issue the tr command, which translates, squeezes and/or deletes characters from standard input, writing back to standard output.
The ^M is a carriage return and I generally handle these in one of two ways. If the file has become one long line of carriage returns, I use the tr command to replace the carriage return with a linefeed with the following command.
cat web.php.test |tr '\015' '\012' >web.php.test
In some cases though, the linefeed is already there and you really do not want the file to have a space between each line, particularly for configuration files. You can remove the carriage return and leave the spacing of the file alone with the following command.
cat web.php.test |tr -d '\015' >web.php.test
In my example I am redirecting the standard output directly into and over the existing file. If you are working with sensitive data, you would probably want to redirect your output file to a different name than the original file.