Replace newline by comma Commands Add comments May 292014 Replace newline by comma Answer: To replace all newline in a file by command, you can use the command # tr '\n' ',' < input.txt > output.txt Related posts: Remove newline character from the end of a string in Perl Echo without a newline at the end How to print out a newline character using the echo command? xargs when the filename contains a newline Replace infile using sed and make a backup automatically Leave a Reply Cancel reply Name (required) E-mail (required) URI Your Comment You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>