I have a text file containing a single column of data as below :
1
2
3
4
5
6
I want to split this into multiple columns using awk or sed command as follows:
1 2 3
4 5 6
How can I do this? Thanks in advance
here is another approach
paste -d' ' - - - < file
with awk
awk 'ORS=NR%3?FS:RS' file
also
pr -3ats' ' file
This should work because echo is a default command for xargs
xargs -n 3 file
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With