Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 12-30-2005, 10:13 AM   #1
Registered: May 2005
Posts: 275

Rep: Reputation: 30 writing to a specific line in a text file

am trying to write an app that will read a text file, look for specific lines and when they are found....replace that line with something else leaving the rest of the file the same. The file order must stay in tact, that is I can not just append to the end or beginning. The change needs to be made exactly where the line occurs in the text file. Can anyone help me as to how this would be done?
Old 12-30-2005, 11:20 AM   #2
Registered: Dec 2004
Location: Vietnam (Việt Nam)
Distribution: Gentoo (desktop), Arch linux (laptop)
Posts: 728

Rep: Reputation: 33
I assumed that is Microsoft Visual Basic .Net right?

Therefore it is not a linux issue.

But as I remember (I have give up windows for half a years), you will have to use stream to do so.
Go to MSDN website or get the MSDN CD and search for the details about how to use stream.

I have written a program on VB.Net which can operate with text file.
It didn't solve your problem directly, but you can use it for an example (or use it instead of notepad) about how to use stream.
That is not a good soft but I hope it have something helpful for you.
Download it at
Old 12-30-2005, 01:38 PM   #3
Senior Member
Registered: Mar 2005
Location: USA::Pennsylvania
Distribution: Slackware
Posts: 1,065

Rep: Reputation: 45
De Ja Vu anyone..
Old 12-30-2005, 10:24 PM   #4
Registered: Dec 2004
Location: Vietnam (Việt Nam)
Distribution: Gentoo (desktop), Arch linux (laptop)
Posts: 728

Rep: Reputation: 33
Originally Posted by xhi
De Ja Vu anyone..
Forgive me for my poor English, but can you express your idea in a easier to understand way?


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Writing to a specific line in a text file mrobertson Programming 6 12-30-2005 04:02 PM
SED - display text on specific line of text file 3saul Linux - Software 3 12-29-2005 04:32 PM reading and writing to a text file simultaneously mrobertson Programming 3 09-08-2005 12:30 PM
Writing to a text file mrobertson Programming 5 08-04-2005 12:37 PM
Shell script - how to show a specific line of a text file davi_cabral Linux - Software 3 09-28-2004 01:39 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:21 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration