I want all my data to stay on one line(row) however many lines as needed but it should start a new line after the "Mount" using format.
use strict;
my (@dfary,@stats,$free,$stat);
format LOG_TOP =
REPORT OF FILESYSTEM USAGE on:
@<<<<<<<<<<<
my ($host) = qx(hostname) =~ /^([^.]+)/;
page @<<
$%
MBblocks, Free, %Used, Mount,
.
format LOG =
^*
$stat.+","
~~
.
my $DFOUT = new FileHandle "/usr/bin/df -m|" || die "df did not open $
+!";
my $percent = q|30|;
while (<$DFOUT>) {
next if $. == 1;
next if /proc|net/i;
for $stat ( (split(" ", $_, 0))[1,2,3,6]) {
chomp $stat;
($free) = /(\d+)%/;
if ( $free >= $percent ) {
write (LOG);
#last;
#push (@stats, $stat);
}
else {
next;
}
}
}
$DFOUT->close;
# for (@stats) {
# write (LOG);
#}
__OUTPUT__
REPORT OF FILESYSTEM USAGE on:
xxxxxxxx
page 1
MBblocks, Free, %Used, Mount,
8512.00,
3232.28,
63%,
/usr,
10240.00,
2367.96,
77%,
/var,
4096.00,
1923.06,
54%,
/tmp,
should be
MBblocks, Free, %Used, Mount,
8512.00, 3232.28, 63%, /usr,
10240.00,2367.96,77%,/var,
etc.
thankU!