in reply to patern matching whitespace, / and others

I think unpack might make sense here, since these appear to be fixed-width columns. The only thing that makes me hesitate is the information about /home is on the line below it. I'm not sure whether this was intentional or not, but could probably be solved with a bit of data massaging before passing to unpack. Here's a snippet that assumes the data has been cleaned up:

#!/usr/bin/perl use strict; use warnings; my $template = "A14 A7 A7 A9 A10 A7 A7 A9 A9"; my @quotas; push @quotas, [ unpack $template, $_ ] while <DATA>; use Data::Dumper; print Dumper(\@quotas); __DATA__ Filesystem usage quota limit timeleft files quota limit + timeleft /var/mail 1394 15360 16384 0 0 0 /home 255999 307200 308224 34 0 0

Replies are listed 'Best First'.
Re: Re: patern matching whitespace, / and others
by jcpunk (Friar) on Mar 01, 2004 at 23:22 UTC
    Cool, thanks I'll look into that
    sadly yes, /home is on a new line on some of my machienes (I HATE YOU SOLARIS), but I may have a way around that so.......

    thanks


    jcpunk
    all code is tested, and doesn't work so there :p (varient on common PM sig for my own ammusment)