I have been playing about with Pulse Audio of late, and it has commands which can be used to get info and control PA.
So I can generate a list of what is active in PA using the command
pactl listThat gives an output of many things, but what I am interested in is extracting information about the loaded modules. This is what part of the list looks like ...
Module #25
Name: module-switch-on-port-available
Argument:
Usage counter: n/a
Properties:
Module #29
Name: module-null-sink
Argument: sink_name=MySink
Usage counter: 2
Properties:
module.author = "Lennart Poettering"
module.description = "Clocked NULL sink"
module.version = "2.0-1pclos2012"
Module #30
Name: module-loopback
Argument: sink=MySink
Usage counter: n/a
Properties:
module.author = "Pierre-Louis Bossart"
module.description = "Loopback from source to sink"
module.version = "2.0-1pclos2012"
Module #31
Name: module-loopback
Argument: sink=MySink
Usage counter: n/a
Properties:
module.author = "Pierre-Louis Bossart"
module.description = "Loopback from source to sink"
module.version = "2.0-1pclos2012"
As can be seen from the above, there are two 'Name: module-loopback' entries.
Although I can load the modules by name, I can only unload them again using the ID number. So I need, I believe, to search the list for each instance of the module name and then extract the module ID # from the previous line, so that number can be used to unload the module.
I hope I am making some sense

As an example
Module #31
Name: module-loopback
Argument: sink=MySink
Usage counter: n/a
Properties:
module.author = "Pierre-Louis Bossart"
module.description = "Loopback from source to sink"
module.version = "2.0-1pclos2012"
I want to search for
Name: module-loopback and store
31Alternatively I suppose I could search for all module numbers (could be quite a few) then look for a matching string for the module name I want, and store the last number encountered.
I would appreciate some help with this .... what might be the
best simplest approach etc.
Sorry should have mentioned ....... BASH
Any help appreciated, thank you
