I have a lot of tab delimited data that is organized into multiple rows and should be all in two rows. Now it looks like this:
Some Key Other key Foo Key Bar Key
0 5 18 12
More Key Dor key Gee Key Francis Scott Key
19 14 8 0
Wa Key Whis key Don Key Luh Key
0 2 8 16
And I need it to look like this:
Some Key Other key Foo Key Bar Key More Key Dor key Gee Key Francis Scott Key Wa Key Whis key Don Key Luh Key
0 5 18 12 19 14 8 0 0 2 8 16
I’ve got a few hundred csv files with about 20 rows each, 30 columns, so I want to script my way through this as much as possible. I’m using Python CSV, but I can’t figure out how to explain myself to it.
This should do it:
Save this as thingie.py and run it with
python thingie.py < sample.csv(where “sample.csv” is your data file)