Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Wer kennt sich mit dem AWK aus???

Empfohlene Antworten

Veröffentlicht

Hab da nen kleine Problem im AWK.

Ich möchte innerhalb eines Perlscriptes den AWK aufrufen und damit den Inhalt eines Arrays bearbeiten. Die Felder im Array sind alle gleich strukturiert. Bsp.:

/var/run

/var/run/osx.man 6548

/Var/run/osx/lib/temp 225

/opt

/opt/bin/xyz.man 9814

/opt/bin/abc 65768

und so weiter, nach dem Filesystemen sortiert. Nun will ich das die Dateigrössen am Ende des Feldes zusammenaddiert und nach der letzten Datei im jeweiligen Filesystem die Gesamtgrösse diese Dateien ausgegeben wird.:confused: :confused:

Hook nochmal,

hier mal ein kurzer quickhack:

my @test = ("t/e/st 12 ", "a/b/c 13");

my $sum;

foreach (@test)

{

print "Dateinname + Groesse: $_\n";

$_ =~ /(.*?)\s(\d+)/g;

print "Dateiname: $1\n"; ## im Idealfall wenn keine Leerzeichen im Dateiname

$sum += $2;

}

print "Summe: $sum\n";

Es funktioniert zwar, aber wenn z.B. eine Vereichnis so aussieht:

/opt/ich bin/das Verz 12/juhu/bli/bla/blub 12345

dann hast halt das Problem dass hier die 12 genommen wird anstatt die 12345.

Der RegEx kann bestimmt noch optimiert werden.

MfG

alligator

:D :D :D :uli Vielen Dank, du hast mir sehr weitergeholfen!!!

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.