Functions of particular interest to you will be split and sort. Here's a code example to get you on your way.
#! /usr/bin/perl use strict ; use warnings ; $|++ ; # Read the data into a 2d array chomp( my @lines = <DATA> ) ; my @data = () ; foreach ( @lines ) { my @cells = split ; push @data, \@cells ; } # Sort the list by user. my @data_by_name = sort { $a->[0] cmp $b->[0] } @data ; # Sort the list by date & time. my @data_by_date = sort { $a->[3] <=> $b->[3] || $a->[4] <=> $b->[4] } @data ; __DATA__ u12345 x10 qwerty 20020725 1421 u12357 x11 asdf;; 20020727 1524 u12245 x12 perl 20020722 1941 u12145 x13 python 20020725 1825 u12945 x14 /bin/sh 20020724 1331 u12545 x15 grep 20020721 1921
In reply to Re: Sorting big text lists
by DamnDirtyApe
in thread Sorting big text lists
by Infinity
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |