Parse data

Guys , please help me out with another AWK solution ...

Input

 
Device Physical Name     : Not Visible
Device Symmetrix Name    : 0743
Front Director Paths (2):
        {
        ----------------------------------------------------------------------
                                 POWERPATH  DIRECTOR   PORT             LUN   
                                 --------- ----------  ---- -------- ---------
        PdevName                 Type      Type Num    Sts  VBUS TID SYMM Host
        ----------------------------------------------------------------------
        Not Visible              N/A       FA   03H:0  RW   000  00  012  N/A
        Not Visible              N/A       FA   14H:0  RW   000  00  012  N/A
        }
RDF Information
        {
        Device Symmetrix Name                  : 0743
        RDF Type                               : R1
        RDF (RA) Group Number                  : 33                (20)
        Remote Device Symmetrix Name           : 1B85
        Remote Symmetrix ID                    : 000192601512
        RDF Mode                               : Asynchronous
 
        RDF Pair State (  R1 <===> R2 )        : Consistent
 RDF Information
        {
        Device Symmetrix Name                  : 0743
        RDF Type                               : R1
        RDF (RA) Group Number                  : 99                (62)
        Remote Device Symmetrix Name           : 0883
        Remote Symmetrix ID                    : 000192604766
        RDF Mode                               : Synchronous
 
       RDF Pair State (  R1 <=\=> R2 )        : Split

Ouput needed

 
Device Symmetrix Name ,[Front Director Paths],[Remote Device Symmetrix Name Remote Symmetrix ID  RDF (RA) Group Number  RDF Mode RDF Pair State]
0743,[03H:0 14H:0],[1B85 000192601512 33 Asynchronous Consistent],[0883 000192604766  99 Synchronous Split]

Thanks

What needs to be done to the input to get the output?

Input is basically my reference file which i need to parse most likely using Awk to get the desired output .need to find all the fields in red and format them to get the output as above .Hope it is clear ...thx

I am still stuck with this issue , will appreciate any help ..... thx

This works to some extent , but i cannot figure out the "Front Director Paths " part
Also how do i make number of records dynamic ? , for example the input file can have more than 2 records ....

 
nawk 'BEGIN{print "Device Symmetrix Name,[Front Director Paths],[Remote Name   Remote Symm   Group Number   Mode  State ],[Remote Name   Remote Symm   Group Num
ber   Mode  State ]"}
/^Device Symmetrix Name/{a=$NF}  /Group Number/{d[++i]=$NF} /Remote Device Symmetrix Name/{c=$NF} 
/Remote Symmetrix ID/{e=$NF} /Mode/{f=$NF}
/State/{g=$NF;p++} p==2{print a,"[" c[1]"\t"d[1]"\t"e[1]"\t"f[1]"\t"g[1]"] ","[" c[2]"\t"d[2]"\t"e[2]"\t"f[2]"\t"g[2]"]" ;i=p=0;}
' OFS=, /tmp/input

Output

 
Device Symmetrix Name,[Remote Name   Remote Symm   Group Number   Mode  State ],[Remote Name   Remote Symm   Group Number   Mode  State ]
0743,[1B85      33      000192601555    Asynch  Consistent] ,[1BBB      55      000192601333    Synch   Split]

This is how I would do it:

awk '
    function print_stuff(   i )
    {
        printf( "Device Symmetrix Name,[Front Director Paths]" );       # header with one 'section' for each RDF section
        for( i = 1; i <= rdf_idx; i++ )
            printf( ",[Remote Name   Remote Symm   Group Number   Mode  State ]" );
        printf( "\n" );

        printf( "%s,[", dsn );                              # data line; one section for each RDF
        for( i = 1; i <= fdp_idx; i++ )
            printf( "%s%s", i > 1 ? " " : "", fdp );
        for( i = 1; i <= rdf_idx; i++ )
            printf( "%s,[%s %s %s %s %s]", i == 1 ? "]" : "", rdf[i,4], rdf[i,5], rdf[i,3], rdf[i,6], rdf[i,7]  );
        printf( "\n" );
    }

    /---/ || /{/  ||  NF < 1 { next; }                      # ignore these lines
    /Device Physical Name/ {                                # new major section
        if( dsn )
            print_stuff( );                                 # print last gathered data and reset indexes
        dsn = "";
        fdp_idx = 0;
        rdf_idx = 0;
        next;
    }
    /Device Symmetrix Name/  && dsn == "" { dsn = $NF; next; }
    /PdevName/ { fd_snarf = 1; next; }                      # safe to capture fdp data

    /}/ { fd_snarf = 0; next; }                             # stop capturing fdp data
    fd_snarf { fdp[++fdp_idx] = $(NF-5); next; }

    /RDF Information/ { rdf_sidx=1; rdf_idx++; rdf_snarf=1; next; }
    rdf_snarf {                                             # capture all RDF lines, but we will only print some
        n = split( $0, a, ":" );
        split( a[n], b, " " );
        rdf[rdf_idx,rdf_sidx++] = b[1];
        next;
    }

    END { print_stuff( ); }                                 # final print of last major section
' input-file >output-file

It will capture 1 or more RDF information sections, and one or more front descriptor paths. It will also capture more than one 'major section' if there are multiple instances of the section you pasted.

Hope this at least gets you started.