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!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.