473,883 Members | 2,819 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Remove Lines in a text file

a
I'm trying to remove specific lines from text files.

I need to always remove lines 1 thru 8 and lines 10 and 11 from text files.

Seems like a simple task, but I'm not getting it.

I'm reading the file via webresponse as a stream and then trying to remove
the lines before parsing it and then writing it to an sql table.

Any ideas on how I can accomplish the line removal/deletion?

Thanks,

Paul
Nov 17 '05 #1
1 7715
string[] lines = myString.Split( Environment.New Line)

now you have the lines, just choose and join the ones you want
Maybe there is a more optimal solution for this, but this should work fine.

"a" <a@discussions. microsoft.com> wrote in message
news:EF******** *************** ***********@mic rosoft.com...
I'm trying to remove specific lines from text files.

I need to always remove lines 1 thru 8 and lines 10 and 11 from text files.
Seems like a simple task, but I'm not getting it.

I'm reading the file via webresponse as a stream and then trying to remove
the lines before parsing it and then writing it to an sql table.

Any ideas on how I can accomplish the line removal/deletion?

Thanks,

Paul

Nov 17 '05 #2

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

Similar topics

6
1790
by: qwweeeit | last post by:
For a python code I am writing I need to remove all strings definitions from source and substitute them with a place-holder. To make clearer: line 45 sVar="this is the string assigned to sVar" must be converted in: line 45 sVar=s00001 Such substitution is recorded in a file under: s0001="this is the string assigned to sVar"
8
2867
by: JT | last post by:
i have written some asp that reads a fixed length text file, line by line, inserting each line into my database. my problem is that the text file format seems to have extra space at the end of the file so my code thinks there is actually one more line when there is not. is there a way to remove these spaces before i loop through the file? here is my sample code: Do While df.AtEndOfStream <> True line = df.ReadLine
2
9606
by: Becker | last post by:
This is probably a very dumb question, I am using VB.NET 2003 and I see where I can use a method to append text to a textbox, but how about remove? I have a textbox that I continually post log type data to and I want to keep it limited to 500 lines of text so that old lines get removed. How can I remove lines of text from a textbox? Thanks, Ben
3
3741
by: Li Pang | last post by:
Hi, I want to know the easiest way to remove the last line in a text file, or how to catch the last line of a text file. Thanks in advance
2
2254
by: Quentin | last post by:
I have a text file with lines that I would like to remove above a certain word and below another word. Example: 1231231231234123423434 2341234123412341242141 234512353764316236234 1235635326235125134534 Recipe
1
1691
by: Quentin | last post by:
First off, I would like to thank those who have given me help so far! I would like to remove all the lines of data above the word Recipe in a text file and all the lines below the words "End of Recipe" in this file. I want to keep everything inbetween these two lines. Below is a small sample of my text file and the code I have so far. 2,3,5,6,56,7,4,7,,,56,5,7, -1,45,4,451,7,66,7,667, "Recipe KX009.RCP, Date=02/11/07, Time=12:20:27,
8
4204
by: Umesh | last post by:
Please help. THANKS.
1
2525
by: buggtb | last post by:
Hi Guys, I've been given the joyous task of updating some very old scripts at work and I could do with a little help. Our Unix system dumps text files to pseudo spoolers that our windows machines can then pick up and process. Now the guy who wrote one of the reports is obviously a bit clueless and the certain lines don't match up so for example our % line is a couple of spaces too far across. A09 62371 __7.20%
3
5624
by: Barkingmadscot | last post by:
I am stuck, i can workout how to remove lines from an array I have loading a text file (a Log), I know which lines a need, but the logs can be upto 30K sometimes bigger. I found trying to delete the lines from the log file before loading in the array took ages, i thought i would be alot quicker to put in an array and remove the unwanted lines. Dim text As Array Dim lines As New List(Of String)
0
9944
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
10762
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...
0
10422
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
9586
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
7977
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
7136
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();...
1
4622
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4228
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3241
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.