473,734 Members | 2,567 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2607


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>c o.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.PhoneNumb er INTO List2Cleaned
FROM List2 LEFT JOIN List1 ON List2.PhoneNumb er = List1.PhoneNumb er
WHERE (((List1.PhoneN umber) 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
2234
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 something, I'd appreciate it. I'm trying to update my website, and I created about eight pages of html code on a Mac, using Simple Text. I viewed all pages locally on my Mac using Netscape, and they looked fine.
5
714
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, FileAccess.ReadWrite, FileShare.None); which does not prevent me from opening the file even if another user has the file open ie Notepad, it will prevent me from saving the file in notepad until i close the file in the app. I can then save changes made in...
1
4398
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. The DOS program I made in Turbo C++ 3.0. At this moment I am in a test phase of sending files and directories. The code I am using in DOS to open a file for writing looks like this (forgive me the typos, since I only have my source code at work...
14
1906
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. Reestablishing some default settings and settings is a small price to pay for a set of text files that may save your database from total loss #AND# seem to remove the database bloat as well. I was wondering if someone knew how to preserve the...
10
2374
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 there is such information to be displayed are they coming from imported files, database ? Where and how this type of information is stored ? What is the way to retrieve such information in order to display it in page ?
5
2265
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 Application called "Lesson18b" under "C:\Inetpub\wwwroot\Lesson18b". 2) I have one Web Form on this Lesson called "Form18b.aspx" 3) In this same Folder under Inetpub I have the Microsoft NorthWinds
10
110276
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 it also integrates UPX (Ultimate Packer for eXecutables) into the build process, if you have it installed. It also claims functionality on linux, as a bonus (I didn't test this). I highly recommend the UPX options, and will cover how to get it...
9
2315
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 continue asking for help (so my rank may finally increase). Right now the topic at hand for me is opening file dialogs. Right now, the issue at hand is opening up a fully functional G.U.I. file prompt (both for opening and saving files please) that has...
1
3077
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 with the outcome out this, Code for Registration: Dim savefile As Long savefile = FreeFile() Open "I:\College Work ------- Updated 2008 March\new-work\savedfile.txt" For Output As #savefile Write #savefile, (Text1.Text); (Text2.Text)
0
8776
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9449
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9310
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9236
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6735
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6031
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4809
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2724
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.