i have written a script which will extract the tags from a .doc file..

The format of the doc is

ID:001

Class:

Check1

Class:

Check2

ID:002

Class:

Check3

Class:

Check4

im getting the output in excel as below

Class ID

Check1 001

Check2 001

Check3 002

Check4 002

I want the output to be displayed as below:

Class ID

Check1 001

Check2

Check3 002

Check4

If there are multiple occurences (Classes) of same ID, the ID have to be written only once

The snippet is

my $i; for ($i = 0; $i <@array; $i++) { if($array[$i] =~ /^Count\:\s /) { $Count_Name = $1; for ($count = $i; $count >= 1; $count--) { if ($array[$count] =~ /ID:\s*(.+)/ ) { $ID = $1; my $Mycell1 = $Sheet->Range($Sheet->Cells($row +, $col),$Sheet->Cells($row, $col+2)); $Mycell1->{Value}=["Count_Name","$ID"]; $row++; # print $out_fh $sdd."\t".$Fun."\t".$File."\n" +; goto breakingfunction; } } breakingfunction: } } }

In reply to Grouping Multiple Occurences by rajkrishna89

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.