TekWannaBe has asked for the wisdom of the Perl Monks concerning the following question:
Filesystem kbytes used avail capacity Mounted on /xxxdev/xxxx/xxxxx 2016343 1392038 563815 72% / /ppppp 0 0 0 0% /proc mnrop 0 0 0 0% /etc/mnrop hd 0 0 0 0% /xxxdev/hd ssss 3888816 40 3888776 1% /var/run ssss 3888848 72 3888776 1% /tmp /xxxdev/xxx/xxxxxxxx 32442879 523718 31594733 2% /export/ho +me
format DISKSPACE = ====================== |@<<<<<<<<<<<<<<<<<<<| $Filesystem |@<<<<<<<<<<<<<<<<<<<| $kbytes |@<<<<<<<<<<<<<<<<<<<| $used |@<<<<<<<<<<<<<<<<<<<| $avail |@<<<<<<<<<<<<<<<<<<<| $capacity |@<<<<<<<<<<<<<<<<<<<| $Mounted_On ====================== . sub df_total { open my $dfout, "df -k|" or die "couldn't start df -k: $!"; open (DISKSPACE, "> spaceavail") || die "Error opening file spaceavail +"; while (<$dfout>) { #chomp; ($Filesystem, $kbytes, $used, $avail, $capacity, $Mounted_On) = split +(//); write (DISKSPACE); } } print "\n My First Perl Menu\n"; print "A. Current Date & Time\n"; print "B. Users currently logged in\n"; print "C. Name of working directory\n"; print "D. Contents of the working directory\n"; print "E. Names & Login names of user currently logged on to aries\n" +; print "F. Aries Disk Space Utilization\n"; print "Enter A, B, C, D, E, F: \n"; $answer = <STDIN>; chomp ($answer); if ($answer eq "A") { system "date \n"; } elsif ($answer eq "B") { system "who \n"; } elsif ($answer eq "C") { system "pwd \n"; } elsif ($answer eq "D") { system "ls -Fla \n"; } elsif ($answer eq "E") { system "finger \n"; } elsif ($answer eq "F") { system "df -k \n"; &df_total } else { print "The selection you entered: $answer, is incorrect. Please ent +er A, B, C , D, E or F \n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Formatting Text Output
by Paladin (Vicar) on Jan 30, 2004 at 22:42 UTC | |
by TekWannaBe (Initiate) on Jan 30, 2004 at 23:13 UTC | |
by ysth (Canon) on Feb 01, 2004 at 08:40 UTC | |
|
Re: Formatting Text Output
by demerphq (Chancellor) on Jan 30, 2004 at 23:44 UTC |