473,654 Members | 3,129 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Search inside a text file, Visual Basic

All
Hi
I have a bunch of text files which need to be organized.
What I want to do is to select three continuous lines from
each text file and write them down in another text file.
Each of those three line is started with character such
as "IH".
There are also more lines repeated after these three lines
which are started with the same character, but I do not
want to take them.

Please let me know how I can write a function in VB that
does that.

Thanks
Regards
All

Nov 20 '05 #1
1 5802
Hello,

"All" <ar*@coe.neu.ed u> schrieb:
I have a bunch of text files which need to be organized.
What I want to do is to select three continuous lines from
each text file and write them down in another text file.
Each of those three line is started with character such
as "IH".
There are also more lines repeated after these three lines
which are started with the same character, but I do not
want to take them.


Have a look at the classes 'StreamReader' and 'StreamWriter' in the
'System.IO' namespace. You can use the 'StreamReader'' s 'ReadLine' method
to read a line from the file.

Regards,
Herfried K. Wagner
--
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #2

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

Similar topics

0
5785
by: mm | last post by:
Can someone with Win 2K please help me here. Best yet, can some MVP duplicate it and report it to MS. I can't find any reference to this issue on the Web, or in MS Knowledge Base. I have been able to duplicate this problem on two different Win 2K installations. Steps: 1. Win 2K installation, SP4 with .NET 1.1 installed
60
49059
by: Julie | last post by:
What is the *fastest* way in .NET to search large on-disk text files (100+ MB) for a given string. The files are unindexed and unsorted, and for the purposes of my immediate requirements, can't be indexed/sorted. I don't want to load the entire file into physical memory, memory-mapped files are ok (and preferred). Speed/performance is a requirement -- the target is to locate the string in 10 seconds or less for a 100 MB file. The...
0
1554
by: Sushil Srivastava | last post by:
Hi Guys, I have developed a utility that provide a smart MSDN knowledge base search both off-line and on-line. I have describe more in detail below why I decided to write this utility (one reason is just for fun). Please let me know if you need this utility. Thanks Sushil
3
3802
by: Bre-x | last post by:
Hi, I have a text file that is made of a number of paragraphs: each paragraph start with either: ":O", ":N", or ":" follow by a 4 digit number and finish with either: M30 or M99 What I need to do is go down the file and capture the text between and create a new text file for each occurrence using the name of the original file plus the first line less the ":"
5
4833
by: Stewart Saathoff | last post by:
Hello, I am trying to search the file system from a string of text located inside of a textbox on a form and have it return a list of file names in a list box on that same form. Does anyone know where I can find a sample of that? Thanks Stewart
2
1803
by: Darko | last post by:
I have a Microsoft (R) Visio (TM) document, which contains a link inside (eg. to "http://blabla/"). When I do a full-text search from within Windows Explorer, searching for "blabla", it finds that document. But when I view the document as a plain text file, viewing it in Notepad or Wordpad, or even programmatically searching for the text "blabla" from a C programme, then it can't be found. I would like to make a C programme that would be...
3
1755
by: pa2ratczi | last post by:
hi folks, just want to ask some procedure in terms of searching files with visual basic. The program i want to make id that i want to be able to search file by just entering a file name in a text box, chose a drive where i wanted to search the file, and display it on a list box,... and the output in a list box must contains the following: 1. the file name it itself. 2. complete location of the file.. currently i havent coded anything yet....
11
2270
by: RivaCom | last post by:
I am using a Access Database to search/add a bunch of information in MS VB.net 2005 express. In the query (querybuilder) everything seems right, but in the WHERE statement I use = me.textbox.text . Then in the statement I have an if statement IF combobox.text = option1 Then e.databaseadapter.GetDataBy2() 'which is the query i built end if
0
10751
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information inside an image, hide your complete image as text ,search for a particular image inside a directory, minimize the size of the image. However this is not a new concept, there is a concept called Steganography which enables to conceal your secret...
0
8372
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8814
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
8706
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
8475
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
8591
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7304
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...
0
5621
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
4149
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
1915
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.