- For individual users
- Instant access to solutions
- Ask your tech questions
- Start your 30-day Free Trial
Main Topics
Browse All TopicsGood day experts,
I am trying to set up a console application, and make it somehow universal.
What the purpose of all this is spliting a huge text file in smaller bits , and the separation is based on particular criteria , a part of a string and the position of the string in each row of the original tab delimited file.
The string and position criteria might change so that is why I decided I will put them in an XML file so if anything changes I can simply edit the XML file.
I attach an example of the xml file , it`s very simple.
Let me explain with very clear example.
Let`s say
I have tab delimited file looking like this:
**ABCBF HJIIYT LLOOIHGGGFFDD
NHUYTR HIIOP AAAAAAAAJKO
Let`s suppose that in thesecond row the part AAAAAAAA that is in the second row is betwwen 96th and 103th character in the row.We have that bit in the XML file.
The idea is the program to be able to check in every row if the string elements in the XML file are existing in each row of the tab delimited file in the position specified in the XML file for each String(CountStart and CountEndPosition).
Then if a row contains the string from XML file and is in the position specified in the XML file for that particular string , then write the row in file a.txt with the same formating as the original field.
Hence we need to read row 1 and loop throught XML values and see if we find a match in between the XML strings , if we do then write row in file a.txt if not then write the row in file b.txt.Then go to next row until the end.
I was thinking of parsing the XML elements to an array , and then loop through the array while reading the tab delimited file and see if you find matches.
So far I have only managed to get the Values displaying in the cmd prompt window, which has nothing to do with what I want to do.
I am a newbie and don`t really know much yet.
I am posting my code here and attach the XML file(which I think is correctly structured according to what I want to achieve, as this is my file as well)
Please see the XML file and my code below
Thanks very much in advance
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: TiggeritoPosted on 2009-05-30 at 02:35:06ID: 24508409
I don't have much time, so here's something to get you started in structuring your solution. Sorry, its in C# styled pseudo code.
I would create a class that has the properties Name, CountStartPosition and CountEndPosition . Lets call it MatchString.
Then parse the xml into a List of MatchStrings. Note, I included a static method in the class to help parse in the data.
List<MatchString> matchStrings
Finally create another method in the class to try and find the matched string from a row. If there is a match then return the text that matched, otherwise return null.
This should make it eaiser for you to parse in the data and then use it to find matches.
Select allOpen in new window