使用default_track显示字幕的轨道ID:1
awk -F'[ :]+' '$4=="subtitles"&&/default_track:1[[:space:]]/{print $3}'
例如:
输入:
Track ID 2: subtitles (VobSub) [number:3 uid:2187650980 codec_id:S_VOBSUB codec_private_length:348 codec_private_data:73697a653a203139323078313038300a6f72673a20302c20300a7363616c653a20313030252c20313030250a616c7068613a20313030250a736d6f6f74683a204f46460a66616465696e2f6f75743a20302c20300a616c69676e3a204f4646206174204c45465420544f500a74696d65206f66667365743a20300a666f7263656420737562733a204f46460a70616c657474653a203030303030302c206630663066302c206363636363632c203939393939392c203333333366612c203131313162622c206661333333332c206262313131312c203333666133332c203131626231312c206661666133332c206262626231312c206661333366612c206262313162622c203333666166612c203131626262620a637573746f6d20636f6c6f72733a204f46462c2074726964783a20313030302c20636f6c6f72733a203030303030302c203434343434342c203838383838382c206363636363630a language:eng default_track:1 forced_track:0 enabled_track:1 content_encoding_algorithms:0]
输出:
2
我正在尝试将language:eng
添加到过滤器中。但我所尝试的一切并不是很有效。有人可以帮帮我吗?
答案 0 :(得分:3)
我会写:
awk -F'[ :]+' '$4=="subtitles" && /\<default_track:1\>/ && /\<language:eng\>/ {print $3}'
\<
和\>
标记是字边界断言,会阻止匹配“default_track:10”