| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| Hi, I try to compare two files using regina rexx.But with no success. What must I do to compare two files? How can I put the result to one file? Thanks, Xi |
|
#2
| |||
| |||
| Xizor wrote: > Hi, > > I try to compare two files using regina rexx.But with no success. What > must I do to compare two files? How can I put the result to one file? > > Thanks, > Xi Comparison algorithms are not trivial: how many lines to match for synchronization and how to treat white space, immediately come to mind. DOS once had a program called FC (formerly Filcomp) which had binary or text flags to select the type of compare. Perhaps it still lurks somewhere on your system. Regards, Richard |
|
#3
| |||
| |||
| > DOS once had a program called FC (formerly Filcomp) which had binary or > text flags to select the type of compare. Perhaps it still lurks > somewhere on your system. > > Regards, > Richard FC is there but I need the output to be written in one file and also only the records that are different. |
|
#4
| |||
| |||
| On Wed, 6 Aug 2008 18:37:58 UTC, Xizor <mn@mn-ix.de> wrote: > Hi, > > I try to compare two files using regina rexx.But with no success. What > must I do to compare two files? How can I put the result to one file? Go look for a port of the *nix program "diff" for whatever OS you use. -- Regards Dave Saville NB Remove nospam. for good email address |
|
#5
| |||
| |||
| Can't use diff because I don't get it installed on that server. REXX is the only thing I have except the DOS-Tools (from Windows 2003 Server). Fc or comp don't fulfill my needs because I need only the file which is different from the others. |
|
#6
| |||
| |||
| > What must I do to compare two files? Store file #1 in a "stem", AKA compound variable. Read a line from file #2, and try to find it in the stem. If found, clear the line in the stem so it isn't found twice or more and stpo searching. > How can I put the result to one file? If found, don't write the line to file #3. What have you tried so far? --- |
|
#7
| |||
| |||
| Here's what I did: do while lines(dat1) <> 0 origdat1 = lines(dat1) origdat2 = lines(dat2) if origdat1 == origdat2 then write to file1 else write to file2 end the write is call lineout of course. |
|
#8
| |||
| |||
| argh, mistyped... > do while lines(dat1) <> 0 > origdat1 = linein(dat1) > origdat2 = linein(dat2) |
|
#9
| |||
| |||
| > origdat1 = lines(dat1) > origdat2 = lines(dat2) /* Untested, with some obvious side-effects, without optimizations */ lines=0 DO WHILE Lines(dat1)>0 lines=lines+1 line.lines=Strip(LineIn(dat1)) IF line.lines='' THEN lines=lines-1 END CALL LineOut dat1 line.0=lines IF line.0=0 THEN EXIT DO WHILE Lines(dat2)>0 line=Strip(LineIn(dat2)) IF line<>'' THEN DO found=0 DO i=1 TO line.0 IF line==line.i THEN DO found=found+1 line.i='' END i IF found=0 THEN DO CALL LineOut notindat1,line CALL LineOut notindat1 END IF found>1 THEN SAY line 'occurs' count 'times in' dat1 END END CALL LineOut dat2 --- |
|
#10
| |||
| |||
| > /* Untested Still untested: > ... > IF line==line.i THEN DO > found=found+1 > line.i='' END > END i > ... --- |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.