mentosan Posted September 30, 2008 Share Posted September 30, 2008 Hi guys I'm having a text file and an Excel file. The text file is in this manner: aaaaabbbccc aaabbbccccddd addfgfghjkkkk gghhhjjklmm ...and so on The Excel file contains 2 columns. The first column contains all the strings from the text file, but not in the same order. The second column contains other strings, every string match a string in the first column: aaabbbccccddd | aaaaa22544488 aaaaabbbccc | 111222333zzzcc ...... So I'm looking for a script/code which can generate another text file based on the first text file where strings are replaced using the rules found in the Excel file. the result txt file would be like this: 111222333zzzcc aaaaa22544488 Thank you. Link to comment Share on other sites More sharing options...
PsaltyDS Posted September 30, 2008 Share Posted September 30, 2008 Hi guysI'm having a text file and an Excel file. The text file is in this manner:aaaaabbbcccaaabbbccccdddaddfgfghjkkkkgghhhjjklmm...and so onThe Excel file contains 2 columns. The first column contains all the strings from the text file, but not in the same order. The second column contains other strings, every string match a string in the first column:aaabbbccccddd | aaaaa22544488aaaaabbbccc | 111222333zzzcc......So I'm looking for a script/code which can generate another text file based on the first text file where strings are replaced using the rules found in the Excel file. the result txt file would be like this:111222333zzzccaaaaa22544488Thank you.You need three arrays:1. Read the text file into the first array2. Read the Excel sheet into the second array3. Create the third array to hold your resultsLoop through the first array, and find each item in the second array.Copy the required cell from the second array to the third.When the loop through the first array is done, all the matching data will be in order in the third array.Start coding it, and if you get stuck post your code and get more help.If you are "looking for a script/code" then you are on the wrong forum. This forum is here to help you write it yourself. 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