LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Script to check Doc-BBB against Doc-AAA for inconsistence (http://www.linuxquestions.org/questions/programming-9/script-to-check-doc-bbb-against-doc-aaa-for-inconsistence-252448/)

satimis 11-08-2004 12:22 PM

Script to check Doc-BBB against Doc-AAA for inconsistence
 
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
Code:

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;

Code:

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

XavierP 11-08-2004 12:40 PM

Could I point you to man diff?

satimis 11-09-2004 02:43 AM

Hi XavierP,

Tks for your advice and URL. Test performed as follows;

1)
Original document "doc_a"
Code:

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.
Code:

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;
Code:

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


All times are GMT -5. The time now is 03:37 AM.