Some other commands you may like to investigate are :-
You can add control characters to a file. To put a C-m character (which has ascii value 13) into a file, type C-q then type C-m. This ability to `quote' control characters is useful if you have copied a file from another machine and find that each line has one of these characters on the end. Use query-replace (M-%), input C-M, (quoted as above), to be your target string and nothing as your replacement string.