How can I replace all newlines with space except the last newline.I can replace all newline to space using tr but how I can do it with some exceptions?
Replace all newlines to space except the last
bash;shell script;text processing;tr
You can use paste -s -d ' ' file.txt:$ cat file.txtone lineanother linethird linefourth line$ paste -s -d ' ' file.txt one line another line third line fourth line