Article 4T6NQ make a csv file from a list

make a csv file from a list

by
Drosera_capensis
from LinuxQuestions.org on (#4T6NQ)
Hello everyone.

I have to write a little script in BASH, but I have some troubles to figure out how to design a part of it.

I have the "file" document which is a single column of data.

Code:a
b
c
d
e
f
g
h
i
jAnd I which to create a csv or tsv file with it, converting the single column to a table as follow:

Code:a e h
b f i
c g jI have already figured out that a for loop has to be used to select a fragment of the column every 3 lines with sed. So it might look like something like that:

Code:for column in {1..3};
do
last_line=$((column*2))
first_line=last_line+1

sed -n 'first_line,last_line p' file ;
doneBut it does not work, and I can't find any way to increment the columns on the same document after a tab or a comma.

Does anyone have an idea how can I improve the script?latest?d=yIl2AUoC8zA latest?i=leBlDRRKG74:KIpsifPmsx4:F7zBnMy latest?i=leBlDRRKG74:KIpsifPmsx4:V_sGLiP latest?d=qj6IDK7rITs latest?i=leBlDRRKG74:KIpsifPmsx4:gIN9vFwleBlDRRKG74
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments