0

I've converted a specific line from a text file using sed, and converted the string output into an array of 5 numbers. There are multiple other lines I've done this with. Now I need to throw the data together into a table format.

For example:

1 2 3 4 5
5 10 15 20 25
3 6 9 12 15

into

1   5   3
2   10   6
3   15   9
4   20   12
5   25   15

I've trialled use of awk, column, piping into column with various syntax arrangements, creating a new tempFile to draw from without the extraneous data in the original but I can't seem to find the solution. There's only a handful of questions I can see here in relation, and the only solved ones are a little over my understanding.

markp-fuso
  • 28,790
  • 4
  • 16
  • 36
  • 4
    Does this answer your question? [An efficient way to transpose a file in Bash](https://stackoverflow.com/questions/1729824/an-efficient-way-to-transpose-a-file-in-bash); also consider running a web search on `bash pivot transpose file` for other ideas – markp-fuso Jul 02 '22 at 21:55
  • what you've displayed does not look like an array; if you really have populated an array then please update the question with the output from `typeset -p array_name`; also, what are you doing with the output ... just displaying on the console? saving to a new array? something else? once you get an acceptable answer you may want to go back to the drawing board and look for a solution that takes your raw file and generates the desired output (eg, `awk`) – markp-fuso Jul 02 '22 at 21:58
  • Also, SO is not a code writing service; you're expected to show your effort (eg, research, code); consider reviewing [how do I ask a good question](https://stackoverflow.com/help/how-to-ask) and then come back and update the question accordingly; in particular, show the code you've tried and the (wrong) output generated by your code – markp-fuso Jul 02 '22 at 22:02

0 Answers0