Single column data to multiple columns
awk, bash, linux, sed, shell
Solution
How about:
$ grep -v '^\s*$' file | pr -ts" " --columns 4
1.0 3.0 -5.0 -7.0
-2.0 4.0 6.0 8.0
`grep` is used to remove the blank lines and `pr` to format the output.
Problem
I have data of positive or negative floating point values in a single column which is separated by two empty lines. ``` 1.0 -2.0 3.0 4.0 -5.0 6.0 -7.0 8.0 ``` In bash, what would be the best way to get this data into multiple columns so that the end result looks something like this: ``` 1.0 3.0 -5.0 -7.0 -2.0 4.0 6.0 8.0 ``` In an ideal situation, the solution would work not only for numbers, but also text separated in a similar way.