transpose csv automatically

Viewed 39

I have data in narrow format like so:

Name; Rob;
Age;  23
Date; 23.05.2000 
  

I want to tarsnpose it to wide format automatically:

Name; Age; Date;
Rob;  23;  23.05.2000;              

That's possible if i just copy the first view and paste it with the transpose option. But how can i do that automatically ?

Thanks for help a lot

1 Answers

I recommend GoCSV. It has a number of very useful commands to make transforming CSVs without code very easy, like transpose. It's pre-built for a number of modern platforms, so download and go!

I got rid of the extra spaces between fields in your sample:

Name;Rob
Age;23
Date;23.05.2000
#!/bin/sh
export GOCSV_DELIMITER=';'  # GoCSV expects a comma (',') by default
gocsv transpose file.csv

and I get:

Name;Age;Date
Rob;23;23.05.2000

GoCSV expects

Related