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.

neuste anglegte Datei filtern

Empfohlene Antworten

Veröffentlicht

Hallo zusammen,

hab ein Problem wofür ich gerade noch keine Lösung habe. Hoffe ihr habt eine.

Problem:

Ich habe mehrere Log-Dateien in einem Log Verzeichnis.

Da die Dateibenennung ein bisschen wirr ist und ich sie nicht ändern kann muss ich rausfiltern welche dieser Logdateien die aktuellste ist.

Das ganze möchte ich in Perl oder in einem Shell Skript schreiben.

Kann mir einer helfen?

Gruß

Sascha

Bearbeitet von VF-Sascha

Nach langem probieren hab ich es endlich raus:

my @logfiles=(""); #hier kommen dann die logs rein

my $logfile="";

chdir($logpath);

foreach $logfile (@logfiles)

{

my @modifydate = (localtime( time - ( 86400 * -M $logfile) ))[3..5];

my @today = (localtime)[3..5];

if( "@modifydate" eq "@today")

{

print "$logfile ist das aktuellste";

}

}

Gruß

Sascha

Per Shell (wahrscheinlich unsauber)

'ls' -lt | awk '{print $8}' | head -n 2 | grep '[:alpha:]'

Je nachdem, wie dein alias für 'ls' aussieht, müssen die Parameter noch geändert werden (wenn die ' um ls weg gelassen werden).

Habs in Perl gemacht

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.