[Perl] merge DB problem

Yossi.Itzkovich at lightscapenet.com Yossi.Itzkovich at lightscapenet.com
Wed Oct 23 00:24:43 PDT 2002


Maybe I was not clear enough:  The "N" represents the number of following
lines to be the single value of NAME.
Let me describe the problem again (I may have missed some details in the
original)

Each file(DB) has many multiline records. Each record starts with a header
line with the format:
NAME  N

where:
NAME  is the record's name (unique)
N is the number of following lines that are part of this record.

I have to targets:
1. simple updated file2 :  add records from file1 that do not exist in
file2, in the correct position. that means  that if I have in
file1 : rec1 rec2 rec3
file2:  rec1 rec3  rec4

I want to get:  rec1 rec2 rec3 rec4

2. Get a report of those  diff records between the files (including diff
num of lines in records)

Here is an example file:

kuku 4
first line of record with key=kuku
seond line of record with key=kuku
third line of record with key=kuku
fourth line of record with key=kuku
mumu 2
first line of record with key=mumu
second line of record with key=mumu
shushu 1
the only line in record with key=shushu



As I have already asked it looks like a DBM file. Is there a module that
handle this DBM-like format?




                                                                                                                                 
                      Shlomo Yona                                                                                                
                      <shlomo at cs.haifa         To:      perl at perl.org.il                                                         
                      .ac.il>                  cc:                                                                               
                      Sent by:                 Subject: Re: [Perl] merge DB problem                                              
                      perl-admin at perl.                                                                                           
                      org.il                                                                                                     
                                                                                                                                 
                                                                                                                                 
                      10/23/2002 10:48                                                                                           
                      Please respond                                                                                             
                      to perl                                                                                                    
                                                                                                                                 
                                                                                                                                 



On Wed, 23 Oct 2002 Yossi.Itzkovich at lightscapenet.com wrote:

>
>  no necessarily  same N and not nnecessarily same records..

so is the following example correct?

File1:

kuku 4
this is a record
this is another record
duplicate record
this is yet another record

File2:

kuku 2
duplicate record
this is a record from File2


then you expect to see the following output:

kuku 5
this is a record
this is another record
duplicate record
this is yet another record
this is a record from File2




is this correct?


--
Shlomo Yona
shlomo at cs.haifa.ac.il
http://cs.haifa.ac.il/~shlomo/

_______________________________________________
Perl mailing list
Perl at perl.org.il
http://www.perl.org.il/cgi/listinfo/perl







More information about the Perl mailing list