Mat Posted May 26, 2009 Share Posted May 26, 2009 (edited) Someone asked on h+s how to split a file by lines, so I wrote this. Since it might come in handy to someone, I decided it belonged here.It may be buggy, and Its not perfect. But it works, and is decently efficient.5001 lines:Splitting took: 201.340216424154 millisecondsJoining took: 16.5691198183009 milliseconds100001 lines:Splitting took: 4944.86980887236 millisecondsJoining took: 533.011318477628 milliseconds1000000 Lines: (1 million!)Splitting took: 50457.6548555752 millisecondsJoining took: 6317.87354258712 millisecondsThere is still a bug with JoinFromTemplate, it doesn't add the last file. which is bugging me cause I can't see the problem. FromArray has not been tested as much as the other 2, and I haven't timed it.Code:Edit: code snipped, use this link: _FileSplitByLineMDiesel Edited May 26, 2009 by mdiesel AutoIt Project Listing Link to comment Share on other sites More sharing options...
sensalim Posted July 15, 2009 Share Posted July 15, 2009 Hi, I get error allocating memory when trying to open 628MB (lol, yes I know it's gigantic) text file. Link to comment Share on other sites More sharing options...
Mat Posted July 16, 2009 Author Share Posted July 16, 2009 And what do you want me to do about it? There is a solution though, i'm working on. MDiesel AutoIt Project Listing Link to comment Share on other sites More sharing options...
sensalim Posted July 16, 2009 Share Posted July 16, 2009 Well I was wondering if you were aware of that and since you are working on a solution... Link to comment Share on other sites More sharing options...
Mat Posted July 16, 2009 Author Share Posted July 16, 2009 Well I was wondering if you were aware of that and since you are working on a solution... yer... no problem! This project is very much on a shelf gathering dust, partly due to lack of interest, and also due to me having other stuff that needed doing... then I started a few things... So basically... This isn't going to be on the top of my list for a while.If you want to - the solution will probably be writing to a file line by line, rather than adding it to a variable. Although considerably slower, and still probably not perfect, it should work MDiesel AutoIt Project Listing Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now