[Gllug] heres a perl one to get you thinking

bredroll bredroll at atari.org
Sat Jul 14 05:57:37 UTC 2001


Thanks, worked a treat.

:-)

bred

On Fri, 13 Jul 2001, mallum wrote:

> maybe something like;
> 
> @sorted = sort { (split /\t/, $b)[$x] cmp (split /\t/, $a)[$x] } @unsorted;
> 
> where $x is the field number you want to sort.
> 
> mallum
> 
> on Fri, Jul 13, 2001 at 09:35:24PM -0400, bredroll wrote:
> > Ok, my small dilema is this.
> > 
> > I want to sort an array by the preciding characters after xth occurance of
> > tab in each array element.
> > 
> > ie.
> > 
> > this is an array :-)
> > 
> > 001\tfish\tcow\tcar\moo
> > 002\tbaloon\tbox\tcat\tzoooom
> > 004\taa\tbb\tcc\tdd
> > 
> > so i now want to sort this list by everything after say the second tab
> > (\t) in each element, (ie sort the three using 'cow,box,cc' as the sort
> > data. 
> > 
> > any ideas?
> > 
> > bredroll
> > 
> > 
> > -- 
> > Gllug mailing list  -  Gllug at linux.co.uk
> > http://list.ftech.net/mailman/listinfo/gllug
> > 
> 
> 


-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list