Okay, it has been resolved. The svn checkout was performed in windows, hence all the file's carriage return was in windows format and bash could not handle it. Manually downloading the text files from svn has solved it. Some has suggested the tool "tofrodos" can be used to convert between UNIX and windows format.