![]() |
Hallo en welkom van de Verenigde Staten aan de UNIX en Linux Forum! Bedankt voor uw bezoek en Deelnemen aan onze wereldwijde gemeenschap.
|
|
google unix.com
|
|||||||
| Forums | Registreer | Forum Regels | Links | Albums | Veelgestelde vragen | Ledenlijst | Kalender | Zoeken | Today's Posts | Markeer forums als gelezen |
| Programmeren en Shell Scripting Post vragen over KSH, CSH, SH, Bash, Perl, PHP, sed, awk en andere shell scripts en shell scripting talen hier. |
Meer UNIX en Linux Forum Onderwerpen Misschien vindt u Helpful
|
||||
| Draad | Thread Starter | Forum | Antwoorden | Last Post |
| Perl Fout | dirdamalah | Programmeren en Shell Scripting | 3 | 06-21-2008 06:32 PM |
| Perl, het afdrukken van een string in de kolommen | doubleminus | UNIX voor Dummies Questions & Answers | 5 | 05-21-2008 10:41 PM |
| PERL Fout | Asteroïde | Hoog Niveau Programmering | 3 | 04-25-2008 02:15 |
| drukkerij een lege regel in een bestand (Perl) | kfad | Programmeren en Shell Scripting | 3 | 05-07-2005 04:10 |
| Foutbericht afdrukken naar Windows op poort 515 | Pauls | SUN Solaris | 0 | 12-23-2004 09:51 |
|
|
LinkBack | Thread Tools | Zoeken in deze Thread | Rate Thread | Display Modes |
|
||||
|
Perl drukfout
Scripting Goeroes Hoi, ik ben nieuw in de honingbij perl, En proberen te schrijven een script dat moet drukken van de vrije schijfruimte beschikbaarheid van C en E-stations. Gelieve advies.
Hier is het script fragment en verwachte output: #! / usr / bin /perl use CGI qw /: html3: standaard /; $ spaceuselog \u003d "E: \ \ admin \ \ VOBSpaceUsage \ \ vobspaceusage.log.txt"; $ verslag \u003d "E: \ \ admin \ \ VOBSpaceUsage \ \ vobspaceusage.html"; open (LOG, "> $ verslag") | | die "ERROR schrijven naar logbestand $ logbestand!"; $ datetime \u003d localtime (); $ count \u003d 0; vob $ \u003d ""; $ vobsize \u003d 0; $ totalvobsize + \u003d 0; $ vd \u003d ""; $ som \u003d 0; # @ vobs \u003d `ct lsvob-s-host blrcc1"; @ vobs \u003d ( "\ \ scm_blr_amor","\ \ scm_blr_projects","\ \ scm_blr_misc","\ \ blr_mobile_projects","\ \ blr_mobile_test"); if ($ ENV () OS \u003d ~ m / Windows /) ( $ opslaan \u003d $ ENV (Systeemstation); open (VSU, "> $ rapport") or die "Kan niet openen: $! \ n"; open (VS, ">> $ rapport") or die "Kan niet openen: $! \ n"; $ ct \u003d "cleartool"; ) anders ( open (VSU, "> E: \ \ admin \ \ VOBSpaceUsage \ \ vobspaceusage.html") or die "Kan niet openen: $! \ n"; $ ct \u003d "C: \ \ Program Files \ \ Rationeel \ \ ClearCase \ \ bin \ \ cleartool.exe"; ) push (@ vsu, start_html ( "Vob Space Usage Report"), "\ n"); push (@ vsu, "<p> <b> VOB Backup proces voltooid op Backup Server: <font color\u003dblue> BLRSTG01 </ font color> </ b> '); push (@ vsu, "<p> De VOBs zijn back-up en beschikbaar op de locatie: \ \ blrstg01 \ Clearcase \ Backups map. </ p> "); push (@ vsu, "\ n <td width\u003dauto align\u003dcenter> \u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d \u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d \u003d\u003d\u003d\u003d \u003d \ n "); push (@ vsu, "<p> <b> VOB Grootte Status op VOB Server: <font color\u003dblue> BLRCC1 </ font color> </ b> </ p>"); push (@ vsu, "<table border\u003d1 width\u003dauto> \ n"); push (@ vsu, "<tr> \ n"); push (@ vsu, "<td width\u003dauto align\u003dcenter> <b> Vob Naam </ b> </ td> \ n"); push (@ vsu, "<td width\u003dauto align\u003dcenter> <b> in MB </ b> </ td> \ n"); push (@ vsu, "<td width\u003dauto align\u003dcenter> <b> Grootte in Gb </ b> </ td> \ n"); push (@ vsu, "</ tr> \ n"); push (@ vs, "</ table> '); foreach $ vob (@ vobs) ( $ vobname \u003d $ vob; chomp ($ vobname); push (@ vsu, "<tr> \ n"); push (@ vsu, "<td width\u003dauto ALIGN\u003dLEFT> $ vobname </ td> \ n"); @ vbpath \u003d `ct lsvob $ vob"; foreach $ pad (@ vbpath) ( # Print "\ n $ pad"; $ path \u003d ~ s / \ * / /; $ path \u003d ~ s / \ s / /; # Print "\ n $ pad"; if ($ path \u003d ~ / \ s (\ \ \ \ [a-zA-Z \ \ a-z0-9 \ _ \. \ \ ]*)/) ( # print "\ nVOBPATH -> $ 1 \ n"; $ cdft \u003d "$ 1 \ \ c \ \ cdft"; # print LOG "\ t $ cdft"; $ ddft \u003d "$ 1 \ \ d \ \ ddft"; # print LOG "\ t $ ddft"; $ db \u003d "$ 1 \ \ db"; # print LOG "\ t $ db"; $ sdft \u003d "$ 1 \ \ s \ \ sdft"; # print "\ n Bron Pool ---> $ sdft"; $ vobpath \u003d $ 1; # print "\ nVOBPath >>>>>>>$ vobpath"; ) ) @ totspace \u003d `diruse / m $ vobpath"; @ a \u003d split ( "", $ totspace [-1]); $ totalvobsize \u003d $ a [0]; # Print LOG "\ t \ t $ totalvobsize"; push (@ vsu, "<td width\u003dauto align\u003dcenter> $ totalvobsize </ td> \ n"); $ totalGBsize \u003d ($ totalvobsize / 1024); # Print LOG "\ t \ t $ totalGBsize"; push (@ vsu, "<td width\u003dauto align\u003dcenter> $ totalGBsize </ td> \ n"); ) # push (@ vs "<p> Disk Usage van <b> C </ b> Drive </ p> \ n"); # push (@ vs "<p> Disk Usage van <b> E </ b> Drive (VOBs opslag inbegrepen) </ p> \ n"); # foreach (@ msg) # ( # Print $ _; #) foreach (@ vsu) ( print LOG; ) # push (@ vsu, <table>); foreach (@ vs) ( print LOG; print RLOG; ) open (RLOG, "<E: \ \ Backups \ \ log \ \ rlog.txt"); @ rlog \u003d <RLOG>; voor (@ rlog) ( # Print als / Disk Usage / .. 0 push (@ du, $ _) als / Disk Usage / .. 0 ) $ gezien \u003d 1; foreach $ line (@ du) ( # @ New \u003d split (/ \ s /,$_); chomp ($ line); # Print "\ n $ line"; if (($ line \u003d ~ / ^ [0-9] * /) & & ($ line \u003d ~ / vrije $ /)) ( @ val \u003d split (/ \ s /, $ line); $ new \u003d $ val [0]; $ new \u003d sprintf "% .2 f", $ nieuw; # Print "\ NI ben verwerking C schijf info, De waarde van de nieuwe variabele is $ nieuw"; if ($ nieuw <100,00) ( print "\ nHet Vrije ruimte op BLRCC1 C drive is minder dan 100 GB, Upgrade / Vrij wat ruimte op de schijf"; ) # Else # ( print "\ nHet beschikbare vrije ruimte op BLRCC1 C schijf is $ nieuw"; #) $ val [0] \u003d 0; $ gezien \u003d 0; ) $ gezien \u003d 2; # Print "\ nLooped: $ gezien \ n"; if (($ line \u003d ~ / ^ [0-9] * /) & & ($ line \u003d ~ / vrije $ /) & & ($ gezien \u003d\u003d 2)) ( @ val \u003d split (/ \ s /, $ line); raghu $ \u003d $ val [0]; # Print "\ nValue is $ val [0] \ n"; $ raghu \u003d sprintf "% .2 f", $ raghu; # Print "\ NI ben verwerking E-station info, De waarde van de nieuwe variabele is $ raghu"; if ($ raghu <100,00) ( print "\ nHet Vrije ruimte op BLRCC1 E drive is minder dan 100 GB, Upgrade / Vrij wat ruimte op de schijf"; ) # Else # ( print "\ nHet beschikbare vrije ruimte op BLRCC1 E drive $ raghu"; #) ) print LOG "<p> $ lijn </ p>"; push (@ vs "<p> $ lijn </ p> \ n"); ) nauwe RLOG; nauwe LOG; nauwe VS; nauwe VSU; Nu krijg ik de output, zoals hieronder weergegeven: De beschikbare vrije ruimte op BLRCC1 C drive 103,82 De beschikbare vrije ruimte op BLRCC1 E drive 103,82 De beschikbare vrije ruimte op BLRCC1 C drive 145,17 De beschikbare vrije ruimte op BLRCC1 E drive 145,17 Verwachte output: De beschikbare vrije ruimte op BLRCC1 C drive 103,82 De beschikbare vrije ruimte op BLRCC1 E drive 145,17 |
| Bladwijzers |
| Thread Tools | Zoeken in deze Thread |
| Display Modes | Beoordeel deze draad |
|
|