473,385 Members | 1,673 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,385 software developers and data experts.

line replacing ideas

hey all,
i have 2 notepad files and i want to replace every 3rd line in 1 of the
notepad files with the exact same line in the other notepad file. what's the
easiest way to do this?

thanks,
rodchar
Nov 1 '06 #1
3 823
I'd check out the StreamReader and StreamWriter classes in the
documentation...

Steve

"rodchar" <ro*****@discussions.microsoft.comwrote in message
news:96**********************************@microsof t.com...
hey all,
i have 2 notepad files and i want to replace every 3rd line in 1 of the
notepad files with the exact same line in the other notepad file. what's
the
easiest way to do this?

thanks,
rodchar

Nov 1 '06 #2
Here's some pseudocode that may meet your needs.

Dim position As Integer = 0

Open the first file
Open the second file
Open the output file

While (both input files still have data)
Read in one line from both input files

position += 1
If ((position Mod 3) = 0) Then
Write out line from second input file
Else
Write out line from first input file
End If
Loop

Close all files

-----
Tim Patrick
Start-to-Finish Visual Basic 2005
hey all,
i have 2 notepad files and i want to replace every 3rd line in 1 of
the
notepad files with the exact same line in the other notepad file.
what's the
easiest way to do this?
thanks,
rodchar

Nov 1 '06 #3
thanks for the tips everyone.

"Tim Patrick" wrote:
Here's some pseudocode that may meet your needs.

Dim position As Integer = 0

Open the first file
Open the second file
Open the output file

While (both input files still have data)
Read in one line from both input files

position += 1
If ((position Mod 3) = 0) Then
Write out line from second input file
Else
Write out line from first input file
End If
Loop

Close all files

-----
Tim Patrick
Start-to-Finish Visual Basic 2005
hey all,
i have 2 notepad files and i want to replace every 3rd line in 1 of
the
notepad files with the exact same line in the other notepad file.
what's the
easiest way to do this?
thanks,
rodchar


Nov 3 '06 #4

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

Similar topics

7
by: Rob Meade | last post by:
Hi all, Been a long time since I've been here... /me waves to all.. Ok - my conundrum.. I have a form where a user can enter text and BB codes...for example:
0
by: Tom Brown | last post by:
I need to chain together three linux commands and get the final output. I read the documentation for Popen in the subprocess module for replacing the shell pipe line. I followed the example and...
3
by: saad82 | last post by:
I want to be able to replace a single line in a large text file (several hundred MB). Using the cookbook's method (below) works but I think the replace fxn chokes on such a large chunk of text. For...
9
by: Prakash Singh Bhakuni | last post by:
am replacing the default "Browse..." button for input type=file. This works fine except that the form will only submit after the SUBMIT button is clicked twice. Any ideas on why this is happening...
3
by: amitp | last post by:
Can anyone tell me how can i break a line in MS WORD doc thru VB 6.0 application? I'm replacing the field values with the data from the databse in MS WORD doc. One of my field value is ( "Jan tst....
1
by: nitinloml | last post by:
#!/usr/bin/python import string import re import random import sys import time import fileinput tn = time.time() t = str(tn)
13
by: programming | last post by:
how do i delete from a text file 1 of the following lines: jon|scott adam|smith <--delete paul|clark say i would like to delete the middle line of this txt, in member.txt what php code or...
8
by: =?Utf-8?B?UmF5IE1pdGNoZWxs?= | last post by:
I have a RichTextBox (rtfTerminal below) in which I would like to replace the last line with the last line minus its last character (i.e., do a backspace). I tried the following code, wherein I...
10
blazedaces
by: blazedaces | last post by:
Alright guys, so the title explains exactly my goal. The truth is I'm going to be reading in a lot of data from an xml file. The file is too large and there's too much data to store in arraylists...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.