#!/usr/bin/perl -w use strict; #my $filename = "quotas.txt"; #open FILE, "$filename" or die "Cannot open $filename for reading: $!\n"; #open REPORT, ">report.csv" or die "Cannot open report.csv for writing: $!\n"; undef $/; my $file = ; $/ = "\n"; my ($header,@records) = split /directory\s+/, $file; while (@records){ my $line = shift @records; if ($line !~ /\.\.\./) { # my ($path, $usage, $threshold) = $line =~ / (\S+) #grab path # \D+ # (\d\S+) #stop at the first digit for usage # .*? # \[hard-threshold\] #seek out threshold # .*? # \(\s+(.*?)\) #capture threshold inside parens #/sx; # print REPORT "$path,$usage,$threshold\n"; print "NO ELLIPSIS: $line"; } else { print "ELLIPSIS: $line"; } } __DATA__ Type Path Policy Snap Usage -------------------- ------------------------------ ----------- ----- -------- directory /ifs/home/admin enforcement no 32K [hard-threshold] ( 1.0G) [hard-threshold-exceeded] (no) [container] [usage-with-no-overhead] ( 32K) [usage-with-overhead] ( 103K) [usage-inode-count] (4) directory /ifs/home/ftp enforcement no 31B [hard-threshold] ( 1.0G) [hard-threshold-exceeded] (no) [container] [usage-with-no-overhead] ( 31B) [usage-with-overhead] ( 6.0K) [usage-inode-count] (3) directory /ifs/gpd/data/trufusion/dat... enforcement no 43G /ifs/gpd/data/trufusion/data0003 [hard-threshold] ( 80G) [hard-threshold-exceeded] (no) [container] [usage-with-no-overhead] ( 43G) [usage-with-overhead] ( 95G) [usage-inode-count] (606)