I have a file in the following format :19-08-02  Name                         appel    ok    hope    local  merge   (mk)                                                        juin    nov    sept    oct00:00:t1  T1                            299       0      24      8      3     64          F2                            119       0      11      8      3     62          I1                             25       0       2      9      4     64          F3                            105       0      10      7      3     61          Regulated F2                    0       0       0          FR T1                         104       0      10      7      3     6100:00:t2  T1                            649       0      24      8      3     64          F2                            119       0      11      8      3     62          I1                            225       0       2      9      4     64          F3                            165       0      10      7      3     61          Regulated F2                    5       0       0          FR T1                         102       0      10      7      3     6120-08-02  Name                          appel    ok    hope    local  merge   (mk)                                                        juin    nov    sept    oct00:00:t5  T1                            800       0      24      8      3     64          F2                            111       0      11      8      3     62          I1                             250      0       2      9      4     64          F3                            105       0      10      7      3     61          Regulated F2                    0       0       0          FR T1                         100       0      10      7      3     61and I want to extract some data and write them in an other file CSV file in the following format :            T1   F2     I1      F3    Regulated F2    FR T100:00:t1    299  119    25      105       0           104  00:00:t2    649  119    225     165       5           10200:00:t5    800  111    250     105       0           100.......I just need to extract the values in the  third field appel every 00:00:XXI've tried to use awk but I didn't succeed to have the right script especially the 5th is composed of two words  : Regulated F2. I don't know how to extract it as a single word .Any help please !   
How to extract several data from a file and store it in a csv file?
text processing;sed;awk
Using Perl:perl -lane 'BEGIN{ print(\t\tT1\tF2\tI1\tF3\tRegulated F2\tFR T1); $, = \t } if($F[0] =~ /00:00:t[0-9]+/){ @f[0] = $F[0]; @f[1] = $F[2]; for($i = 2; $i < 7; $i++) { $_ = <>; @F=split(); if($i < 5){ $f[$i] = $F[1] }else{ $f[$i] = $F[2] } } print(@f) }' fileExpanded script (to be made executable with chmod +x script.pl and to be run with ./script.pl file):#!/usr/bin/perl -lanBEGIN {    print(\t\tT1\tF2\tI1\tF3\tRegulated F2\tFR T1);    $, = \t}if($F[0] =~ /00:00:t[0-9]+/) {    $f[0] = $F[0];    $f[1] = $F[2];    for($i = 2; $i < 7; $i++) {        $_ = <>;        @F=split();        if($i < 5) {            $f[$i] = $F[1]        }        else {            $f[$i] = $F[2]        }    }    print(@f) }You can adjust the header by modifying print(\t\tT1\tF2\tI1\tF3\tRegulated F2\tFR T1); and the output field separator by modifying $, = \t.% cat file19-08-02  Name                         appel    ok    hope    local  merge   (mk)                                                        juin    nov    sept    oct00:00:t1  T1                            299       0      24      8      3     64          F2                            119       0      11      8      3     62          I1                             25       0       2      9      4     64          F3                            105       0      10      7      3     61          Regulated F2                    0       0       0          FR T1                         104       0      10      7      3     6100:00:t2  T1                            649       0      24      8      3     64          F2                            119       0      11      8      3     62          I1                            225       0       2      9      4     64          F3                            165       0      10      7      3     61          Regulated F2                    5       0       0          FR T1                         102       0      10      7      3     6120-08-02  Name                          appel    ok    hope    local  merge   (mk)                                                        juin    nov    sept    oct00:00:t5  T1                            800       0      24      8      3     64          F2                            111       0      11      8      3     62          I1                             250      0       2      9      4     64          F3                            105       0      10      7      3     61          Regulated F2                    0       0       0          FR T1                         100       0      10      7      3     61% perl -lane 'BEGIN{ print(\t\tT1\tF2\tI1\tF3\tRegulated F2\tFR T1); $, = \t } if($F[0] =~ /00:00:t[0-9]+/){ @f[0] = $F[0]; @f[1] = $F[2]; for($i = 2; $i < 7; $i++) { $_ = <>; @F=split(); if($i < 5){ $f[$i] = $F[1] }else{ $f[$i] = $F[2] } } print(@f) }' file        T1  F2  I1  F3  Regulated F2    FR T100:00:t1    299 119 25  105 0   10400:00:t2    649 119 225 165 5   10200:00:t5    800 111 250 105 0   100% 