Sorting a text file with C#

Posted by Jamesadove under C# on 2/25/2011 | Points: 10 | Views : 3175 | Status : [Member] | Replies : 4
I am a long time programmer, over 30 years, but new to C# code. I need to know how to sort a text file. The file has a record length of 350 characters. I need a major sort on positions 321 - 330 and a minor sort on positions 1 - 2. Thanks for any help!

This sort will be used as a pipeline component in a BizTalk project.




Responses

Posted by: Madhu.b.rokkam on: 2/25/2011 [Member] [MVP] Bronze | Points: 25

Up
0
Down
Can you expain what you mean by Major sort and Minor sort ?
Is that you mean Ascending and decending ??
Can you please explain this in brief

Thanks and Regards
Madhu

Jamesadove, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jamesadove on: 2/25/2011 [Member] Starter | Points: 25

Up
0
Down
The sort will be ascending. Positions 321 - 330 is the record key, then within the record key, it must be sorted by
positions 1 - 2, the record type. The file as it is given to us is sorted by the record type, which does not put the records in the correct hierarchical order.

Jamesadove, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Madhu.b.rokkam on: 2/27/2011 [Member] [MVP] Bronze | Points: 25

Up
0
Down
Can you pls put a sample file sort of thing may be with 5 records or so ..

Thanks and Regards
Madhu

Jamesadove, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jamesadove on: 2/27/2011 [Member] Starter | Points: 25

Up
0
Down
Attached is a sample of the text file.
 Download source file

Jamesadove, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response