Sorting lines

Gordon Tillman got at mindspring.com
Tue May 29 13:22:34 EDT 2007


Howdy Matthias,


On May 29, 2007, at 12:14, runrev260805 at m-r-d.de wrote:

> Hi,
>
> i have textfile, which contains data. Each line of this text file  
> contains serveral values, which are separated by ;.
> Each line has the  same number of values. My problems is, that i  
> have to sort the lines by one of the values, in this case by the  
> value of the 4th field.
>
>
> My textfile looks something like this. There are about 42 fields  
> per line.
>
> 320;4999;219,Peter;329;366
> 1000;999;10101;Mark;211;555
> 2;214;25;Peter;212:667
> 2;213;13;Josh;215;666
> 3;23;14;Mark;0;0
> and so on
>
>
> I have to sort the textfile by the 4th value (the names). I need  
> all lines with the same name in field4 one below the other -  
> similar like this:

just read the contents of the file into a variable.  then do  
something like this (suppose the variable "tlines" has the data from  
the file):

set the itemDelimiter to ";"
sort lines of tlines by item 4 of each

Then write it back out to the file.

--gordy




More information about the use-livecode mailing list