Re: Text Script



So you need to compare line1 of file1 with every line in file2 and so on for
every line in file1.
What is the template for the item you are searching for?
Is it a stable template (eg 999999 0r 999-99-9999 or (999)999-9999 ) or is
it variable? (eg sometimes it's 99 sometimes 9999) where the "9" is a
template for any number.
Is it always in the same place in the line?

Please understand that you have not given enough information to be able to
design a method for doing this. Suppose more than one number is in the line
and the number you want is the second or third number. How do we know which
number to match?
--
Jim Vierra

"Scott Burns" <ScottBurns@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:F3AF02FC-FBAA-4AC7-867B-2F33464BE190@xxxxxxxxxxxxxxxx
> Below is what I have written so far. I have file1 that comes from one
> computer with dollar figures in it listed by account number in no
> sequential
> order. I have File2 from another computer that is in no order either. I
> need to readline in file2 to find an account number. I then need to find
> the
> same account number in file1 and print specific information in a specific
> format to one text file.
>
> Both files contain about 200 or so lines and could contain more then that.
> I know I need to use one file as my master to query the second file with.
> I
> have gotten as far as the first line of data but I can't get it to go to
> the
> next line of both files. It only queries the file for the first line.
>
> Please help.
>
> Dim fso, Tip, file1, file2
> Set fso = CreateObject("Scripting.FileSystemObject")
> set Tip = fso.CreateTextFile("Tip.txt")
> set file2 = fso.OpenTextFile("79600")
> set file1 = fso.OpenTextFile("0241_2005A")
> Do While Not file2.AtEndOfStream
> str=file2.ReadLine
> str2=file1.Readline
> if Mid(str,310,12)=Mid(str2,3,12) then
> 'Tip.WriteLine "P"&"B"&
> rtrim(Mid(str,310,12))&"241"&rtrim(Mid(str,12,10))&rtrim(Mid(str,437,9))&rtrim(Mid(str2,10,9))
> 'above is what I want but below is my test of duplicating file names to
> make
> sure it works
> Tip.WriteLine "File2"&rtrim(Mid(str,310,12))&"File3"&rtrim(Mid(str2,3,12))
> End if
> Loop
> Tip.Close
> file2.Close
> file3.Close
> Wscript.Quit
>
> --
> Scott Burns
>
>
> "Al Dunbar [MS-MVP]" wrote:
>
>>
>> "Scott Burns" <ScottBurns@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>> news:A5255BB8-8C97-47F1-972E-CABF4ECA518C@xxxxxxxxxxxxxxxx
>> > I am looking for some help with a script. I am trying to read two text
>> > documents and read line by line and find similar data. After I find
>> > that
>> > similar data like an account number I want to then merge the two to the
>> same
>> > line. Please help out if possible.
>>
>> Your difficulty may lie in the vagueness of the description of the
>> problem
>> and of the problem set.
>>
>> By "merge the two to the same line" do you mean to write out the two
>> similar
>> records to a third file on the same line, or to cause the original
>> similar
>> lines to be changed in the two input files such that they both contain a
>> copy of each of the two similar values?
>>
>> By similar data, do you mean numerical values that are mathematically
>> close
>> to each other? How close? Or do you mean words that sound the same, like
>> "bow" and "bough"? Or would "vvvvvvvv" be similar to "wwwwwww"?
>>
>> If the value in line 10 in file A is similar to the value in line 15 in
>> file
>> B would you want to match line 15 in file A with line 10 in file B if
>> they
>> happened to be similar?
>>
>> Or... is it a line by line match: if line 1 in both files do not match,
>> do
>> nothing. if line 2 does match, write the output to a third file?
>>
>> Perhaps a sample set of data showing us which data you consider similar
>> and
>> which you do not, plus the desired result.
>>
>> /Al
>>
>>
>>


.



Relevant Pages

  • Re: Text Script
    ... I have file1 that comes from one ... I have File2 from another computer that is in no order either. ... need to readline in file2 to find an account number. ... > records to a third file on the same line, or to cause the original similar ...
    (microsoft.public.windows.server.scripting)
  • Re: Text Script
    ... I have file1 that comes from one ... >>> computer with dollar figures in it listed by account number in no ... I have File2 from another computer that is in no order either. ... >>> I know I need to use one file as my master to query the second file ...
    (microsoft.public.windows.server.scripting)
  • Copy node values from one xml to the other (tags are removed!)
    ... File2 so the File1 and ends up with the xml; ... template so it gives out only the values, not the xml nodes. ...
    (microsoft.public.dotnet.xml)
  • Re: Help -- how to get the difference of these two files
    ... What I need is to get the rows in file2 but not in file1. ... the comparision should not take the last filed as account (i.e. ... For lines that appear only once in the combined files. ...
    (comp.unix.shell)
  • Re: REWRITE query
    ... > This para first gets the account number to be amended, ... > Then reads 'file1' to see if this account exists. ... > ALTERNATE RECORD KEY IS Account-name ... > select Transactions ASSIGN TO "file2.dat" ...
    (comp.lang.cobol)