Cheers - L~R#!/usr/bin/perl use strict; use warnings; my @data; while ( <DATA> ) { next if /^host:volume/; chomp; my @field = $_ =~ /^([^:]+):([^\s]+)\s+(\d+)\s+(\d+)/; push @data, \@field; } for ( sort { $data[$a]->[2] <=> $data[$b]->[2] } 0 .. $#data ) { print join "\t" , @{ $data[$_] }; print "\n"; } __DATA__ host:volume available(MB) %free 10.100.200.1:/dev/hda3 10168 80% 10.100.200.1:/dev/hda2 84 90% 10.100.200.2:/dev/hda3 10168 80% 10.100.200.2:/dev/hda2 84 90%
In reply to Re: sort array by value in it
by Limbic~Region
in thread sort array by value in it
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |