PDA

View Full Version : Script to check Doc-BBB against Doc-AAA for inconsistence



satimis
8th November 2004, 06:34 PM
Hi folks,

I'm going to make a script checking inconsistence on 2 documents

Doc-BBB is reproduced from Doc-A, (original document) not with 'copy and paste' command.

Making it simple first, as highlighted in following example, an one line document:-

Doc-AAA
Check this link to sea what scannars are supported by SANE
Doc-BBB
must be reproduced exactly the same as Doc-AAA, disregarding the typing mistake (spelling mistake)
sea = should read “see”
scannars = should read “scanners”
in order to make sense.

That is to check Doc-BBB to be 100% consistent to Doc-AAA even spelling mistake existing. If a mistake is found on Doc-BBB the mistake will be printed out in pair, such as;


Doc-AAA Doc-BBB
sea sei
character “i” will be highlighted or changed to another colour and its line number and word number also indicated..

Can any folk shed me some light how to start?

TIA

B.R.
satimis

Jman
8th November 2004, 11:14 PM
Start with the diff command. It compares two files. If they were supposed to be exactly alike, any differnences will be outputted.

See
man diff for the documentation.

satimis
9th November 2004, 08:45 AM
Hi Jman,

Tks for your advice. Test performed as follows;

1)
Original document "doc_a"
Check this link to sea what scannars are supported by SANE
Already having 2 typing mistakes
sea
scannars

2)
But the reproduced document "doc_b" must maintain these 2 mistakes for consistence.

check thes link to sea what scannars are suppurted by SeNE
Unfortunately another 3 typing mistakes were further made;
thes
suppurted
SeNE


$ diff doc_a doc_b
It only printed out the content of doc_a and doc_b. I have tried the options on --help

What I expect to have in the printout is;

Original Mistake Line No. Word No.
this thes 1 2
supported suppurted 1 9
SANE SeNE 1 11
not just printing out their contents and saying "differ"

B.R.
satimis