0
尋找一種方式的體積從處理文本在bash - 提取的節目的從PACTL水槽-輸入輸出
pactl list sink-inputs
提取卷輸出例如:
Sink Input #67
Driver: protocol-native.c
Owner Module: 12
Client: 32
Sink: 0
Sample Specification: s16le 2ch 44100Hz
Channel Map: front-left,front-right
Format: pcm, format.sample_format = "\"s16le\"" format.channels = "2" format.rate = "44100" format.channel_map = "\"front-left,front-right\""
Corked: no
Mute: no
Volume: front-left: 19661/30%/-31.37 dB, front-right: 19661/30%/-31.37 dB
balance 0.00
Buffer Latency: 100544 usec
Sink Latency: 58938 usec
Resample method: n/a
Properties:
media.name = "'Alerion' by 'Asking Alexandria'"
application.name = "Clementine"
native-protocol.peer = "UNIX socket client"
native-protocol.version = "32"
media.role = "music"
application.process.id = "16924"
application.process.user = "gray"
application.process.host = "gray-kubuntu"
application.process.binary = "clementine"
application.language = "en_US.UTF-8"
window.x11.display = ":0"
application.process.machine_id = "54f542f950a5492c9c335804e1418e5c"
application.process.session_id = "3"
application.icon_name = "clementine"
module-stream-restore.id = "sink-input-by-media-role:music"
media.title = "Alerion"
media.artist = "Asking Alexandria"
我想提取所述
30
從線
Volume: front-left: 19661/30%/-31.37 dB, front-right: 19661/30%/-31.37 dB
注意:可以有多個水槽輸入,並且我需要僅提取從水槽的體積輸入#67
由於
P.S.需要這個我的腳本應該增加或減少我的音樂播放器的音量。我對linux和bash都是全新的,所以我無法想出解決問題的方法。
編輯: 我的awk版本
[email protected]:~$ awk -W version
mawk 1.3.3 Nov 1996, Copyright (C) Michael D. Brennan
compiled limits:
max NF 32767
sprintf buffer 2040
你在這個社區中看到過類似的問題,你做了什麼?有很多這樣的例子可用 – Inian
我一直在谷歌搜索過去幾個小時,但沒有成功。 awk,grep和其他一些對我來說太難了,因爲我太新手了,對此沒有經驗。對不起,如果有很多類似的問題,但我仍然沒有找到解決此問題的方法:c –
好的!所以有幾個問題。輸出中是否有多個「Sink Input#67」?哪個'30'應該被提取?對於「左前方」和「前右」都是相同的值 – Inian