Solved

CROSSING DATA BETWEEN TWO TEXTFILES

Posted on 2003-11-01
6
231 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

Author Comment

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

Thank you.

EN
0
 
LVL 100

Expert Comment

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

mlmcc
0
 

Author Comment

by:eminitta
Comment Utility
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

HOW TO: Upload an ISO image to a VMware datastore for use with VMware vSphere Hypervisor 6.5 (ESXi 6.5) using the vSphere Host Client, and checking its MD5 checksum signature is correct.  It's a good idea to compare checksums, because many installat…
In this step by step tutorial with screenshots, we will show you HOW TO: Enable SSH Remote Access on a VMware vSphere Hypervisor 6.5 (ESXi 6.5). This is important if you need to enable SSH remote access for additional troubleshooting of the ESXi hos…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

771 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now