#!/bin/bash
echo "\"Least squares\",regularity,variability,improvement,steps,\"Evolution error\",sigma"
cat "$1" | grep "EVOL" \
         | sed -s "s/info: EVOL: //" \
         | grep -v "Evolvability" \
         | grep -v "current error is" \
         | sed -s "s/fitting done.. Error: //" \
         | sed -s "s/Evolution step \(.*\): \(.*\)\t\(.*\)/\1\n\2\n\3/" \
         | sed -s "s/regularity:  //" \
         | sed -s "s/variability: //" \
         | sed -s "s/improvement: //" \
         | while read -r ONE; do
            read -r TWO
            read -r THREE
            read -r FOUR
            read -r FIVE
            read -r SIX
            read -r SEVEN
            echo "$ONE,$TWO,$THREE,$FOUR,$FIVE,$SIX,$SEVEN"
        done
