Re: Text Script
- From: "Jim Vierra" <jvierra@xxxxxxx>
- Date: Thu, 5 May 2005 10:39:09 -0400
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
>>
>>
>>
.
- Follow-Ups:
- Re: Text Script
- From: Scott Burns
- Re: Text Script
- References:
- Text Script
- From: Scott Burns
- Re: Text Script
- From: Al Dunbar [MS-MVP]
- Re: Text Script
- From: Scott Burns
- Text Script
- Prev by Date: Re: Credentials Change for Accessing Com componet on remote machin
- Next by Date: Re: Text Script
- Previous by thread: Re: Text Script
- Next by thread: Re: Text Script
- Index(es):
Relevant Pages
|