We help IT Professionals succeed at work.

Multiple text files into one text file with the lines in order

297 Views
Last Modified: 2010-04-16
I have multiple text files and I want to take their lines in order and place them into one new text file.

e.g.
file a line 1
file b line 1
file c line 1
file a line 2
file b line 2
file c line 2
etc

I have very minor scripting knowledge, an annotated code would be much appreciated.
Thanks,
Comment
Watch Question

Commented:
How many files are there, and how many lines in each one - max upper limit will do.

Author

Commented:
There are 3 files right now each with 71 lines. It'd be nice, but not necessary to be able to adjust these numbers. Thank you.

Commented:
Ok, what language can this be coded in?
CERTIFIED EXPERT
Top Expert 2010
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
I was looking for python or vb:
matthewspatrick: thanks it worked.
peetm: I get an error "expected end of statement" for line: 1 char: 11.

I would appreciate a short annotation of what the code commands are, since I dont know what they mean.  I don't know why either of the above is better, it doesn't really matter, I'd just like to have a basic idea of what's going on.
CERTIFIED EXPERT
Top Expert 2010
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Commented:
>>peetm: I get an error "expected end of statement" for line: 1 char: 11.

Yup - the code is VB, not vbs.  If the other posted code - which was vbs - works for you, just go with that.

Author

Commented:
Thank you all
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.