Solved

3 lines in one

Posted on 2001-06-27
5
130 Views
Last Modified: 2010-05-02
i have a text file
c:\Bob\log.txt
it has info on 3 lines that i need in a new text file,with the 3 lines combined, then loop thru the whole text file and combine
 
bob
fred
stan
mel
ralph
pete

bob fred stan
mel ralph pete
0
Comment
Question by:underground712
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 43

Expert Comment

by:TimCottee
ID: 6230727
Open "MyFile1" For Input As #1
Open "MyFile2" For Output As #2
Do
  Input Line #1,strLine1
  Input Line #1,strLine2
  Input Line #1,strLine3
  Print #2,strLine1 & " " & strLine2 & " " & strLine3
Loop Until Eof(1)
Close #1
Close #2
0
 
LVL 43

Expert Comment

by:TimCottee
ID: 6230734
Sorry that should be:

Open "MyFile1" For Input As #1
Open "MyFile2" For Output As #2
Do
 Line Input #1,strLine1
 Line Input #1,strLine2
 Line Input #1,strLine3
 Print #2,strLine1 & " " & strLine2 & " " & strLine3
Loop Until Eof(1)
Close #1
Close #2
0
 
LVL 43

Accepted Solution

by:
TimCottee earned 50 total points
ID: 6230735
Sorry that should be:

Open "MyFile1" For Input As #1
Open "MyFile2" For Output As #2
Do
 Line Input #1,strLine1
 Line Input #1,strLine2
 Line Input #1,strLine3
 Print #2,strLine1 & " " & strLine2 & " " & strLine3
Loop Until Eof(1)
Close #1
Close #2
0
 
LVL 18

Expert Comment

by:deighton
ID: 6230771
Open "MyFile1" For Input As #1
Open "MyFile2" For Output As #2
Do Until Eof(1)
Line Input #1,strLine1
Line Input #1,strLine2
Line Input #1,strLine3
Print #2,strLine1 & " " & strLine2 & " " & strLine3
Loop
Close #1
Close #2
0
 
LVL 1

Expert Comment

by:eosu
ID: 6231174
Sorry - not clear on the question - you want every 3 lines merged into 1? or just the first 3, in which case what do you want done with the remaining lines?
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month10 days, 11 hours left to enroll

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question