no way to compare when less than two revisions
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| — | adminstoriesdfhundduh [20120823 10:00] (aktuell) – angelegt Dirk Deimeke | ||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| + | ====== dfh und duh ====== | ||
| + | * Urspruenglicher Autor: Dirk Deimeke | ||
| + | * Urspruengliches Datum: 24.06.2011 | ||
| + | |||
| + | Da ich auf verschiedenen Unix- und Linux-Versionen unterwegs bin und gerade die Unix-Systeme den Parameter " | ||
| + | |||
| + | Aufgerufen werden die Skripte mit '' | ||
| + | |||
| + | Grundlage der Skripte ist die Funktion '' | ||
| + | |||
| + | <code perl>sub to_human_readable( $ ) { | ||
| + | my ($number) = @\_; | ||
| + | my @postfix = qw( k M G T P ); | ||
| + | my $post; | ||
| + | my $divide = 1; | ||
| + | foreach (@postfix) { | ||
| + | $post = $_; | ||
| + | last if (($number / ($divide * 1024)) < 1); | ||
| + | $divide = $divide * 1024; | ||
| + | } | ||
| + | $number = int($number/ | ||
| + | return $number . $post; | ||
| + | }</ | ||
| + | |||
| + | Dann sind da noch die beiden Funktionen '' | ||
| + | |||
| + | <code perl>sub trimlengthright ( $$ ) { | ||
| + | my ($txt, $len) = @\_; | ||
| + | if ( length($txt) >= $len ) { | ||
| + | $txt = substr($txt, | ||
| + | } else { | ||
| + | $txt = $txt . " " x ($len - length($txt)); | ||
| + | } | ||
| + | return $txt; | ||
| + | } | ||
| + | sub trimlengthleft ( $$ ) { | ||
| + | my ($txt, $len) = @\_; | ||
| + | if ( length($txt) >= $len ) { | ||
| + | $txt = substr($txt, | ||
| + | } else { | ||
| + | $txt = " " x ($len - length($txt)) . $txt; | ||
| + | } | ||
| + | return $txt; | ||
| + | }</ | ||
| + | |||
| + | Der Unterschied beider Skripte liegt an der Schleife, die durchlaufen wird, hier ist '' | ||
| + | |||
| + | <code perl># | ||
| + | use strict; | ||
| + | my @line; | ||
| + | sub to_human_readable( $ ) { | ||
| + | # wie oben | ||
| + | } | ||
| + | sub trimlengthright ( $$ ) { | ||
| + | #wie oben | ||
| + | } | ||
| + | sub trimlengthleft ( $$ ) { | ||
| + | # wie oben | ||
| + | } | ||
| + | open(DF," | ||
| + | while (< | ||
| + | @line = split; | ||
| + | next if $line[0] eq " | ||
| + | print & | ||
| + | print & | ||
| + | print & | ||
| + | print & | ||
| + | print & | ||
| + | print " ", | ||
| + | } | ||
| + | close DF;</ | ||
| + | |||
| + | Und hier kommt '' | ||
| + | |||
| + | <code perl># | ||
| + | use strict; | ||
| + | my @line; | ||
| + | sub to_human_readable( $ ) { | ||
| + | # wie oben | ||
| + | } | ||
| + | sub trimlengthright ( $$ ) { | ||
| + | #wie oben | ||
| + | } | ||
| + | sub trimlengthleft ( $$ ) { | ||
| + | # wie oben | ||
| + | } | ||
| + | open(DU," | ||
| + | while (< | ||
| + | @line = split; | ||
| + | print & | ||
| + | print & | ||
| + | } | ||
| + | close DU;</ | ||
| + | |||
| + | [[adminstoriesartikel|Zurück zur Uebersicht]] | ||