Writting a script to break a file
Posted by saleem (saleem), 3 June 2005Hi
I have a long file, I want to split this file into several files.
Any one have some idea how this can be done:
this is what i want:
I want to split this way:
and so on.
any help please.
Posted by admin (Graham Ellis), 4 June 2005I'm not sure what criteria you use to decide to finish one file and start the next ... but you probably want something like:
Posted by saleem (saleem), 5 June 2005
Thank you for your reply.
I have this much working already, the problem is I want to break this file which has more than 500 lines.
Each line is almost same except there is a number changing in them.
So my problem is i want to put each two lines from this file into a seperate file.
If i try to put a loop this always gets only one line and put into another file. but how can make this to use 2 lines. this is how my lines look like:
I want to put:
and so on.
Thanks for your time.
Posted by admin (Graham Ellis), 5 June 2005Replace the text "condition to see if new file needed" in my original example with the condition that applies in your case - which is going to be something like
The words in my original were only an example - I couldn't write the complete code for you as you hadn't told me about the condition. In any case, we're here to help with programming problems and not write complete solutions
This page is a thread posted to the opentalk forum at www.opentalk.org.uk and archived here for reference. To jump to the archive index please follow this link.
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: firstname.lastname@example.org • WEB: http://www.wellho.net • SKYPE: wellho