# If you'd like to omit non-matching lines from the result; add ';d' to the end of the expression.
sed -E 's/(?<=m=video)(?s)(.*)(a=sendrecv)/$1a=sendonly/gm;t' <<< "v=0
o=- 582127838 582127838 IN IP4 172.17.217.8
s=Commend
c=IN IP4 172.17.217.8
t=0 0
m=audio 16882 RTP/AVP 8 107 9 0
a=rtpmap:8 PCMA/8000
a=rtpmap:107 opus/48000/2
a=fmtp:107 useinbandfec=1
a=rtpmap:9 G722/8000
a=rtpmap:0 PCMU/8000
a=ptime:20
a=maxptime:20
a=sendrecv
m=video 15132 RTP/AVP 99
a=rtpmap:99 H264/90000
a=sendrecv
"
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for SED, please visit: https://www.gnu.org/software/sed/manual/html_node/The-_0022s_0022-Command.html