473,386 Members | 1,886 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Simple question regarding opening/finding/saving data in text files.

Okay here's the scenario:

I have two big lists of numbers. One number on each line (they're telephone
numbers if that helps.) What I want to do, is have VB search through
list2.txt for numbers that are also in list1.txt and delete them. I would
usually sit and figure this out myself but I have the flu and I know how
helpfull you guys are :P~

Thanks in advance to anyone that can help.

-Ben-
Jul 17 '05 #1
3 2589


Ponder
Okay here's the scenario:

I have two big lists of numbers. One number on each line (they're telephone
numbers if that helps.) What I want to do, is have VB search through
list2.txt for numbers that are also in list1.txt and delete them. I would
usually sit and figure this out myself but I have the flu and I know how
helpfull you guys are :P~


How big are the files? If they are small a simple sequential loop
through list2 for each number in list1. Not efficient but simple to
code. If the lists are too large for that, then a better way would be
to sort list2 and use a hashing routine to find each number contained in
list1. That would require list2 to either have fixed width records, or
use a seperate index file of pointers to each record.

Jul 17 '05 #2
On Sat, 6 Dec 2003 17:59:25 -0000, "Ponder"
<ponder_public@yahoo.<NOSPAM>co.uk> wrote:
Okay here's the scenario:

I have two big lists of numbers. One number on each line (they're telephone
numbers if that helps.) What I want to do, is have VB search through
list2.txt for numbers that are also in list1.txt and delete them. I would
usually sit and figure this out myself but I have the flu and I know how
helpfull you guys are :P~

Thanks in advance to anyone that can help.


1) Pull the numbers into an Array

2) Sort them

3) Work through both lists comparing for <, =, >

You may be better off sorting the lists on disk if they are huge, and
then Line Input ing the numbers

For text file sorting see:

www.jerryfrench.co.uk/dsortv.htm
Jul 17 '05 #3

"Ponder co.uk>" <ponder_public@yahoo.<NOSPAM> wrote in message
news:3f***********************@news.ukonline.co.uk ...
Okay here's the scenario:

I have two big lists of numbers. One number on each line (they're telephone numbers if that helps.) What I want to do, is have VB search through
list2.txt for numbers that are also in list1.txt and delete them. I would usually sit and figure this out myself but I have the flu and I know how helpfull you guys are :P~

Thanks in advance to anyone that can help.

-Ben-


Another option would be to import both lists into an Access database.

One simple left join query between the two would give you all the
numbers in List2 that are not in List1, which you could use to create a
third table called List2Cleaned. The SQL might look like this:

SELECT List2.PhoneNumber INTO List2Cleaned
FROM List2 LEFT JOIN List1 ON List2.PhoneNumber = List1.PhoneNumber
WHERE (((List1.PhoneNumber) Is Null));

Then export List2Cleaned as text again if you need it as a text file.

Putting indexes on both PhoneNumber fields will speed up the process for
long lists. That takes one click in Access, versus coding your own in
VB.

This is one area where Access is actually a pretty useful tool. It took
me maybe two minutes to dummy up a sample so I could build the query
shown above.

Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Melissa | last post by:
Hi, I'm new to the group and haven't had a chance to read the FAQ, but I have a question that's driving me crazy. If anyone here can help me with this or can point me to another site or...
5
by: PM | last post by:
Has anyone found a way to open a file exclusively where it will fail if the file is already open, i have tried the following _FileStream = new FileStream(@"C:\Data.txt", FileMode.Open,...
1
by: Alfons | last post by:
Hello, I have build a program that can do file transferring between a Windows XP computer and a DOS computer via a serial port. The Windows program I have build in C++ with Visual Studio 6.0....
14
by: MLH | last post by:
GHudson has working procedures posted at http://www.access-programmers.co.uk/forums/showthread.php?t=66320 They work. Relationships, however, and some minor default settings are not preserved....
10
by: serge calderara | last post by:
Dear all, I need to build a web application which will contains articles (long or short) I was wondering on what is the correct way to retrive those article on web page. In orther words, when...
5
by: samadams_2006 | last post by:
I'm having a problem in accessing a Microsoft Access Database in a VB.NET Web Application. It's so straight forward, I thought I'd walk you through all the details here: 1) I have a .NET Web...
10
true911m
by: true911m | last post by:
This is a simple walkthrough to get PyInstaller up and running. I decided to give PI a try, because it claims to be more selective about what it bundles into its executable files by default, and...
9
compman9902
by: compman9902 | last post by:
Hello, and thank toy for reading this post. Thus far, this website has helped me a lot, (I have finally finished my encryptor: "site removed by moderator", go to the downloads link) and I will...
1
by: carl2k2 | last post by:
Ok First I have a very simple way of entering data into a form and saving that into a text file, I made two text files for username(text1) and password(text2), I would like to make a simple login...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.