Dmesgh: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
Sigi (Diskussion | Beiträge) (Die Seite wurde neu angelegt: «#!/usr/bin/perl # # dmesgh: (c) 2011 by Peter_Siegrist(SystemLoesungen) <PSS@ZweierNet.ch> # This is Free Software. # # Program dmesgh is a dmesg wrapper that pr…») |
Sigi (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
||
| Zeile 1: | Zeile 1: | ||
<syntaxhighlight lang="perl"> | |||
#!/usr/bin/perl | #!/usr/bin/perl | ||
# | # | ||
| Zeile 20: | Zeile 22: | ||
print "[", POSIX::strftime("%b %d %H:%M:%S", localtime($tim)), ".${dmsec}] $rest\n"; | print "[", POSIX::strftime("%b %d %H:%M:%S", localtime($tim)), ".${dmsec}] $rest\n"; | ||
} | } | ||
</syntaxhighlight> | |||
Aktuelle Version vom 10. September 2015, 00:32 Uhr
#!/usr/bin/perl
#
# dmesgh: (c) 2011 by Peter_Siegrist(SystemLoesungen) <PSS@ZweierNet.ch>
# This is Free Software.
#
# Program dmesgh is a dmesg wrapper that prints out the dmesg timestamp (uptime) in a human readable form :)
# usage: dmesgh
#
use POSIX qw(strftime);
my $t0 = time() - int((split(' ', `cat /proc/uptime`))[0]);
foreach ( `dmesg` ) {
chomp;
next if $_ !~ /^\[\s*(\d+)\.(\d+)\s*\]\s+(.*)/;
my $tim = $t0 + $1;
my $dmsec = substr($2,0,3);
my $rest = $3;
print "[", POSIX::strftime("%b %d %H:%M:%S", localtime($tim)), ".${dmsec}] $rest\n";
}