How can I display 3 lines of text at a time onto 1 line?
You might be able to use paste
:
$ paste - - - <data.txt
1 data 2 data 3 data
1 data 2 data 3 data
1 data 2 data 3 data
Here's one way:
$ perl -pe 's/\n/ / unless $. % 3 == 0' file
1 data 2 data 3 data
1 data 2 data 3 data
1 data 2 data 3 data
Or also sed
by "N"omming two lines and then nixing the newlines in the resulting buffer.
sed 'N;N;s/\n/ /g'