#7 Option to specify the number of lines to match

open
nobody
None
5
2013-09-03
2013-09-03
No

In the OpenVMS operating system, the DIFFERENCES utility allows you to specify the number of lines to match before a difference is found.

For example

File1
unit 1 element 1
data for the above
unit 1 element 2
data for the above
unit 1 element 3
data for the above
unit 2 element 1
data for the above
unit 2 element 2
data for the above
unit 2 element 3
data for the above
the end

File2
unit 1 element 1
data for the above
unit 2 element 2
data for the above
unit 2 element 3
data for the above
unit 3 element 1
data for the above
unit 3 element 2
data for the above
unit 3 element 3
data for the above
the end

By default, VMS uses a 3 line match so there is 1 difference between these files...

FREAXP>> diff test1.txt test2.txt/para/mat=3

File SYS$SYSROOT:[SYSMGR]TEST1.TXT;1 | File SYS$SYSROOT:[SYSMGR]TEST2.TXT;1
------------------- 3 ------------------------------------- 3 -----------------
unit 1 element 2 |
data for the above |
unit 1 element 3 |
data for the above |
unit 2 element 1 |
data for the above |
------------------- 13 ------------------------------------ 7 -----------------
| unit 3 element 1
| data for the above
| unit 3 element 2
| data for the above
| unit 3 element 3
| data for the above
-------------------------------------------------------------------------------

Notepad++ Compare (and VMS if you specify/MATCH=1) give many differences...

FREAXP>> diff test1.txt test2.txt/para/mat=1

File SYS$SYSROOT:[SYSMGR]TEST1.TXT;1 | File SYS$SYSROOT:[SYSMGR]TEST2.TXT;1
------------------- 3 ------------------------------------- 3 -----------------
unit 1 element 2 | unit 2 element 2
------------------- 5 ------------------------------------- 5 -----------------
unit 1 element 3 | unit 2 element 3
------------------- 7 ------------------------------------- 7 -----------------
unit 2 element 1 | unit 3 element 1
------------------- 9 ------------------------------------- 9 -----------------
unit 2 element 2 | unit 3 element 2
------------------- 11 ------------------------------------ 11 ----------------
unit 2 element 3 | unit 3 element 3
-------------------------------------------------------------------------------

(This is bacause each "data for the above" line comprises a match).

For clarification, here is the VMS HELP for this...

DIFFERENCES

/MATCH

    /MATCH=size

 Specifies the number of records that should indicate matching
 data after a difference is found. By default, after the
 DIFFERENCES command finds unmatched records, it assumes that the
 files once again match after it finds three sequential records
 that match. Use the /MATCH qualifier to override the default
 match size of 3.

 You can increase the /MATCH qualifier value if you feel that
 the DIFFERENCES command is incorrectly matching sections of
 the master and revision input files after it has detected a
 difference.

Discussion


Log in to post a comment.