Come posso sostituire tutte le newline con lo spazio tranne l'ultima newline.
Posso sostituire tutte le newline nello spazio usando tr
ma come posso farlo con alcune eccezioni?
Risposta accettata:
Puoi usare paste -s -d ' ' file.txt
:
$ cat file.txt
one line
another line
third line
fourth line
$ paste -s -d ' ' file.txt
one line another line third line fourth line