Skip to content

Instantly share code, notes, and snippets.

@James-E-A
Last active May 3, 2023 17:39
Show Gist options
  • Save James-E-A/ef294842f9c15f72c279976699ba4a9a to your computer and use it in GitHub Desktop.
Save James-E-A/ef294842f9c15f72c279976699ba4a9a to your computer and use it in GitHub Desktop.
parse /proc/asound/cards in shell script
perl -0pe 's/^\s*(\S+)\s\[(.*?)\s*\]:\s+(.*)\n\s*(.*)/\1\t\2\t\3\t\4/gm' /proc/asound/cards # | cut -f"${fieldIndex-1}"
# fieldIndex: 1=ID; 2=Type; 3=Name; 4=Description
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment