replace newlines with spaces in ud