![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Oct 2004
Posts: 17
Rep Power: 0
![]() |
Hi folks,
I'm going to make a script checking inconsistence on 2 documents, say doc_a and doc_b and have no idea how to start. doc_b 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:- 1) Original document "doc_a" Check this link to sea what scannars are supported by SANE sea scannars 2) The reproduced document "doc_b" must maintain these 2 mistakes for consistence. check thes link to sea what scannars are suppurted by SeNE thes suppurted SeNE 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 Kindly advise how to start. TIA B.R. satimis |
|
|
|
|
|
#2 |
|
Expert Programmer
|
Look up the source code for the GNU diff program. IT is really difficult to tell you how to start because for a seemingly simple program like this a lot of though and design still needs to go into the algorithm if you want good functionality.
You could just do work checking, store a sequence of words and check them, only problem is that if one document inserts a word and another does not the remainder of the document will be out of sync while a real diff program would understand that it is only a small segment of the document that went out of sync... and this is only one example. Checking the GNU diff source code is honestly probably the best idea if you need to figure out an algorithm. You could also just pipe and reformat the output from diff too.
__________________
Clifford Matthew Roche <geek@cliffordroche.com> Web Hosting: http://www.crd-hosting.com Consulting: http://www.crdev-consulting.com |
|
|
|
|
|
#3 | |
|
Newbie
Join Date: Nov 2004
Posts: 12
Rep Power: 0
![]() |
Quote:
You could open both files the same time foreach line, foreach word, if its different, highlight it. This would solve the problem of "one inserted word" would break the program. But this also would break if they added a new line. If you just want a program to do this, this one looks pretty good http://meld.sourceforge.net/ |
|
|
|
|
|
|
#4 | |||
|
Newbie
Join Date: Oct 2004
Posts: 17
Rep Power: 0
![]() |
Hi kurifu,
Tks for your advice. I'm a newbei in perl. My example is only for preparing an experimental script. Quote:
Quote:
Quote:
What I'm worrying on line checking, cutting the document to lines, is if 1 or 2 words on a line left out to type in, then words on the following line will be push up to fill its/their space. In such case there will be a mess. Any advice. TIA B.R. satimis |
|||
|
|
|
|
|
#5 | ||
|
Newbie
Join Date: Oct 2004
Posts: 17
Rep Power: 0
![]() |
Hi kurifu,
Tks for your advice and URL. Quote:
$ perl compare.sh doc_a.txt doc_b.txt or something similar. Quote:
1) on line checking 2) on words cheching TIA B.R. satimis |
||
|
|
|
|
|
#6 |
|
Newbie
Join Date: Nov 2004
Posts: 12
Rep Power: 0
![]() |
I would suggest you read these tutorials.
You can do very complex "word checking" using perl regular expressions. http://www.comp.leeds.ac.uk/Perl/start.html (read this one first) http://www.perlmonks.org/?node=Tutorials |
|
|
|
|
|
#7 | |
|
Newbie
Join Date: Oct 2004
Posts: 17
Rep Power: 0
![]() |
Quote:
Tks for your advice and URLs B.R. satimis |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|