Page 1 of 1

Sorting on variable length file having variable records

PostPosted: Sat Nov 12, 2016 2:17 pm
by Felcy
Hi guys,
I am struggling to write a sort on file which is of variable length and the data in it doesn't have fixed position.
Input file is like:
Mark aaaaa
Amy bbbbbbb
Hardy cccc
Positions are not fixed
I want to write a sort on length of field before space , in ascending order.,means to perform ascending sort on length of field before space eg mark,Amy...
Looking forward for your replies.
Thanks in advance

Re: Sorting on variable length file having variable records

PostPosted: Sat Nov 12, 2016 4:51 pm
by NicC
Do you mean your output should be:

Amy
Mark
Hardy

'Amy' being 3 bytes and 'Mark' 4 bytes with 'Hardy' 5 bytes?

Re: Sorting on variable length file having variable records

PostPosted: Sat Nov 12, 2016 6:06 pm
by Felcy
Yes nice, it should sort these but on basis of length
Pls help me here, as the positions are not fixed I am struggling to get it.

Re: Sorting on variable length file having variable records

PostPosted: Sat Nov 12, 2016 6:17 pm
by BillyBoyo
Are you going to make up your mind where you want this answered?

Re: Sorting on variable length file having variable records

PostPosted: Sat Nov 12, 2016 6:25 pm
by Felcy
Hey, I am dealing with data which is kind of unformatted,report data.

Re: Sorting on variable length file having variable records

PostPosted: Sat Nov 12, 2016 6:26 pm
by Felcy
NicC wrote:Do you mean your output should be:

Amy
Mark
Hardy

'Amy' being 3 bytes and 'Mark' 4 bytes with 'Hardy' 5 bytes?


Yes rite, waiting for your reply

Re: Sorting on variable length file having variable records

PostPosted: Sat Nov 12, 2016 6:48 pm
by BillyBoyo
NicC was just clarifying what you are asking. You'll be waiting a while.

It is considered poor etiquette to ask the same question in multiple places at once. Locking this topic.