underground712
asked on
3 lines in one
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
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
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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
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
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?
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