I have this awk script:
#!/usr/bin/awk -f
BEGIN {IGNORECASE=1}
/nVidia/ {inner=1;pci=$1}
/(corr|fatal)err\-/ {if (inner) print pci, $1, $2, $3, $4, $5, $6, $7}
$0=="" {inner=0}
is there a syntax to always pipe sudo lspci -vvv
to this script? I'm having to type sudo lspci -vvv|./checkpci
each time I run the script. I know I could create a second script to launch the first script, but I think that is messy and would like to know the proper way to do so.
as an aside, I'm having some issues with my graphics card crashing and have seen the UncorrErr flag on some of the devices, does anyone have a reference as to what this means or how to troubleshoot further? right now I'm just going to run this script periodically to see when the errors show up in lspci to see if there is a time correlation.
This should work for you:
#!/usr/bin/awk -f
BEGIN {
IGNORECASE = 1
cmd = "sudo lspci -vvv"
while ((cmd | getline) > 0) {
if ($0 ~ /nVidia/) {inner = 1; pci = $1}
if ($0 ~ /(corr|fatal)err\-/) {if (inner) print pci, $1, $2, $3, $4, $5, $6, $7}
if ($0 == "") {inner = 0}
}
close(cmd)
}