
open(OUTPUT,">$output") || die "failed to read from $item_list \n" ;

if(open (INPUT ,"<$Iinputfile"))
   {
     while(<INPUT>)
     {
        chomp;
        print "$_\n";
        if ( $_ !~ /Referenced Item Revisions/ )
        {
                next ;
        } 
        $_ = <INPUT> ;
        chomp;
       #while ( $_ =~ /^(\s*)BSHItem/)
       while ( $_ !~ /^$/)
        {
           #print "$_\n";
           ($item_type,$item_id,$item_revision,$relation,$datsettype,$dataset) = split /;/;           
           $input_string = $item_id.";".$item_revision;
           while(<OUTPUT>) 
           {
               chomp;
        
               print "the $input_string and $_\n";
               if($_ eq $input_string )
               {
                    $not_existing = 1;
               }          
           }
           if($not_existing != 1)
           {
               printf OUTPUT "$input_string\n";
           }         
           close(OUTPUT);      
                              
           $_ = <INPUT> ;
           chomp;
        }
        close(INPUT)
     }
