video card info
package main
import (
"fmt"
"os/exec"
"strings"
"regexp"
)
func main(){
var str string
var s string
out1,_ :=exec.Command("lspci").Output()
str = string(out1[:])
fmt.Println(str)
str2:=strings.Split(str,"\n")
r := regexp.MustCompile(`\S+\s([^:]+):\s*(.+?)(?:\(([^()]+)\))?`)
// r1 := regexp.MustCompile(`graphics|vga|video`)
for _,j:=range str2 {
in := []byte(j)
b := r.Find(in)
if b != nil {
s = string(b)
fmt.Println(s)
}
}
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.