#! /bin/sh
## other stuff happens here, but snipped for clarity
scdir=/var/log
find $scdir -type f -name "nts_*.bz2" | # find interesting files in $scdir
perl -wnl -e '7 > -M and print;' | # ignore old files
xargs bzcat -k | # unpack contents to STDOUT
perl -wn00 -e ' # paragraph mode
m[kernel\.hostname\s.\s(.*?)\n] and print "Hostname:\t$1\n"; # grep for hostname
m[\/bin\/date\n(.*?)\n] and print "Generated:\t$1\n"; # grep for date
## I grep for other stuff here, but snipped for clarity
m[Settings.for\s(.*?):\n] and print "Interface:\t$1\n"; # grep for eth interfaces
m[Speed:\s(.*?)Mb\/s] and # grep for interface speed
print "\ -speed:\t$1Mb\/s\n" ;
m[Duplex:\s(.*?)\n] and # grep for interface duplex
print "\ -duplex:\t$1\n" ;
m[Auto-negotiation:\s(.*?)\n] and # grep for interface autoneg
print "\ -autoneg:\t$1\n" ;
m[cpuinfo\nvendor_id\s+:\s(.*?)\n] and # grep for cpu id
print "CPU:\t\t$1\n" ;
'
exit $!
####
Generated: Tue Dec 4 12:12:01 GMT 2007
Hostname: lnx0010
CPU: IBM/S390
CPU: IBM/S390
Interface: hsi0
-speed: 100Mb/s
-duplex: Full
-autoneg: on
Interface: hsi1
-speed: 100Mb/s
-duplex: Full
-autoneg: on
Interface: sit0
-speed: 100Mb/s
-duplex: Full
-autoneg: on
CPU: IBM/S390
Generated: Mon Dec 3 12:34:19 GMT 2007
Hostname: ptsuse3
CPU: GenuineIntel
Interface: eth0
-speed: 100Mb/s
-duplex: Full
-autoneg: on
Interface: eth1
-speed: 100Mb/s
-duplex: Full
-autoneg: on
Generated: Mon Jun 18 15:33:40 BST 2007
Hostname: icore-71
CPU: GenuineIntel
CPU: GenuineIntel
Interface: eth0
-speed: 100Mb/s
-duplex: Half
-autoneg: on
##
##
# /proc/cpuinfo
vendor_id : IBM/S390