Linux – Convert Vertical Text to Horizontal Using tr

linuxtr

I've been reading about https://stackoverflow.com/questions/39791042/convert-vertical-text-into-horizontal-in-shell
and wondering if tr alone can be used to convert vertical text to horizontal.

user@linux:~$ seq 3
1
2
3
user@linux:~$ 

I've tried the following solution, it works but not perfect.

user@linux:~$ seq 3 | tr -d '\n'
123user@linux:~$ 
user@linux:~$ 

Would it be possible to used tr alone to produce output like this?

Desired Output

user@linux:~$ seq 3 | tr command here
123
user@linux:~$ 

Best Answer

Choose whatever works for you.

$ seq 3 | paste -s -d ''
123
$ seq 3 | tr -d '\n';echo
123
$ seq 3 | awk 1 ORS='';echo
123
Related Question