Solved

CROSSING DATA BETWEEN TWO TEXTFILES

Posted on 2003-11-01
6
235 Views
Last Modified: 2010-04-16
Dear Experts,

This is not a homework. I think this needs a hard answer, but possible!

How I do to crossing data between two textfiles?


The textfile one have a text, esp. a large text, for example:
´ This should be concise, but give enough information that an expert will get an idea of whether or not they have the expertise to answer your question.  ´

The textfile two have a list of words, in this way, for example:


concise,n,II
have,v,II
idea,n,I
nevertheless,c,III
the,a,I

The program needs crossing the data between these files and
generates a third file with a stop list of the words from textfile one
found in textfile two, more the information after commas.

It will generate a fourth file with a resume based on information
from textfile two after 2nd comma(I, II and III), in this way:

´The are X words with I.
There are Y words with II
There are Z words with III.

If you are able to do I want, congratulations and more points! You will
contribute to maintain live of MSDOS!

Thank you.

EN
0
Comment
Question by:eminitta
  • 3
  • 3
6 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 9664102
How large is textfile2?

Will all the words in textfile 1 appear in textfile 2?

mlmcc
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 125 total points
ID: 9664139
Basic idea

// Declare variables
Type
   wordlist = Array[1..100] of string;
   
Var
    Word,
    WordId       : string;
    words         : wordlist ;
    wordtype     : wordlist ;
    WordCount,
    CountI,
    CountII,
    CountIII : integer;

    Infile, Outfile   : Text;

Begin
   Open the input file for reading as InFile
   WordCount := 0;
   while Not EOF(Infile)
   begin
       Read a line from the file
       Parse the Word out
       WordCount := WordCount  + 1;
       words[WordCount] :=   Word;
       Skip the comma, the letter, and the comma
       Read the WordID
       wordtype[WordCount] :=   WordId;
    end
    Close the input file
 
    Sort the word list

    Open the Other file for reading as Infile
   while Not EOF(Infile)
   begin
       Read a word from the file
       Search for the word in the list
       If WordType[Index] = "I" then
           CountI := CountI + 1;
       else If WordType[Index] = "II" then
           CountII := CountII + 1;
       else  
           CountIII := CountIII + 1;
    end
       wordtype[WordCount] :=   WordId;
    end while
    Close the input file
 
    Create the other file
    Output the lines

mlmcc
0
 

Author Comment

by:eminitta
ID: 9672069
Dear mlmcc,

I have not Internet in my home! I am seeing your script now. I will test it
in my home.

I want to know how many words from textfile 1 appear in textfile 2.

so long


EN
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 

Author Comment

by:eminitta
ID: 9680474
I tested your program. Could you please give me more code lines?

Thank you.

EN
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 9684074
What more do you need?  I don't have Pascal loaded anywhere right now.

mlmcc
0
 

Author Comment

by:eminitta
ID: 9693302
Yours algorithm is not full. I imagine it is necessary three files. The fiest textfile with a list os words, such as:

the
as
for
in
want

A second file with another list of words, such as:

as
welcome
in
thesaurus


A third textfile with the results of the common words in the twoprior files,

´as´and ´in´

OK? How I add it in your algorithm?

EN
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
Read about the importance of offline branding in the digital age.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question