Pharo Posted December 16, 2008 Share Posted December 16, 2008 I'm unsure how to proceed with this. I have a text file that contains a list with date,person,item 12/15/2008 00:43:21,Bob,Banana 12/15/2008 02:19:13,Greg,Apple 12/15/2008 02:19:31,Bob,Apple 12/15/2008 02:44:33,Julie,Watermelon and so on I can enter it into an array with the below but don't understand how to separate the array from $FileList[1] to $FileList[1][2][3]. After I do that then I need to sort the list by the person then by the item and leave the date with the appropriate person and item. After which I want to create a new text file that would look like. 12/15/2008 02:19:31,Bob,Apple 12/15/2008 00:43:21,Bob,Banana 12/15/2008 02:19:13,Greg,Apple 12/15/2008 02:44:33,Julie,Watermelon All I have that is working so far is not much. I can separate a string and sort a single array but neither is getting me where I want. CODE _FileReadToArray("fruit.txt",$FileList) _ArrayDisplay($FileList,"$FileList") I want the end result to Link to comment Share on other sites More sharing options...
PsaltyDS Posted December 16, 2008 Share Posted December 16, 2008 I'm unsure how to proceed with this. I have a text file that contains a list with date,person,item 12/15/2008 00:43:21,Bob,Banana 12/15/2008 02:19:13,Greg,Apple 12/15/2008 02:19:31,Bob,Apple 12/15/2008 02:44:33,Julie,Watermelon and so on I can enter it into an array with the below but don't understand how to separate the array from $FileList[1] to $FileList[1][2][3]. After I do that then I need to sort the list by the person then by the item and leave the date with the appropriate person and item. After which I want to create a new text file that would look like. 12/15/2008 02:19:31,Bob,Apple 12/15/2008 00:43:21,Bob,Banana 12/15/2008 02:19:13,Greg,Apple 12/15/2008 02:44:33,Julie,Watermelon All I have that is working so far is not much. I can separate a string and sort a single array but neither is getting me where I want. _FileReadToArray("fruit.txt",$FileList) _ArrayDisplay($FileList,"$FileList") I want the end result to There is no function that will do that in one pass. Use the 1D array you already have from the file, create the new 2D array that you will want separately, then loop through the 1D array, StringSplit() each line and copy the parts to your 2D array. The included _ArraySort() UDF will sort a 2D array on one column already, but sub-sorts will have to be coded by you. Save that for last. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law 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