I'm writing a bash
script to get data from procmail and produce an output CSV file.
At the end, I need to translate from this:
---label1: 123456
---label2: 654321
---label3: 246810
---label4: 135791
---label5: 101010
to this:
label1,label2,label3,label4,label5
123456,654321,246810,135791,101010
I could do this easily with a ruby
script but I don't want to call another script other than the bash
script. So I've though of doing it with sed
.
I can extract the data I want like this:
sed -nr 's/^---(\S+): (\S+)$/\1,\2/p'
But I don't know how to transpose it. Can you help me?