?
Solved

3 lines in one

Posted on 2001-06-27
5
Medium Priority
?
133 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 200 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

719 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