Last active
May 3, 2023 17:39
-
-
Save James-E-A/ef294842f9c15f72c279976699ba4a9a to your computer and use it in GitHub Desktop.
parse /proc/asound/cards in shell script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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