Skip to content

Instantly share code, notes, and snippets.

@remi6397
Last active August 14, 2022 10:56
Show Gist options
  • Save remi6397/600ad50503e323a5a3e17fffb394e22a to your computer and use it in GitHub Desktop.
Save remi6397/600ad50503e323a5a3e17fffb394e22a to your computer and use it in GitHub Desktop.
grep in `lspci -v`
#!/bin/bash
ROPT=
while [ -n "$1" ]; do
case "$1" in
-i)
ROPT=I
shift
;;
--)
shift
break
;;
-*)
>&2 echo "Usage: $0 [-i] [--] [regex]"
exit 1
;;
*)
break
;;
esac
done
lspci -v |sed -n '/^\S.*'"${1//\//\\\/}"'/'"$ROPT"',/^$/p'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment