以下のような120kテキストがあり、で終わる行の末尾に「(引用符)を追加したいのですが、lr:
sedまたはawkを使用してこれを行う方法を教えてください。
HSS-ServiceProfile=consumer_mmtel_d426s6
hss-Trigger2ApplicationServers="42601:sip\\:d426s6mtasorig.routingcore.imsw..it;call=orig;lr:
hss-Trigger2ApplicationServers="42603:sip\\:d426s6mtasorig.routingcore.imsw..it;call=orig;lr:
hss-Trigger2ApplicationServers="42605:sip\\:d426s6mtastermrg.routingcore.imsw..it;call=term;lr:
hss-Trigger2ApplicationServers="42607:sip\\:d426s6mtastermnr.routingcore.imsw..it;call=term;lr:
hss-DefaultApplicationServer="sip:d426s6mtasorig.routingcore.imsw..it;lr"
hss-DefaultASHandling="SESSION_CONTINUED"
hss-DsaiCapability=false
送信-s up
HSS-ServiceProfile=Pk3_mmtel_d426s1
hss-Trigger2ApplicationServers="42601:sip\\:d426s1mtasorig.routingcore.imsw..it;call=orig;lr:SESSION_CONTINUED"
hss-Trigger2ApplicationServers="42603:sip\\:d426s1mtasorig.routingcore.imsw..it;call=orig;lr:SESSION_TERMINATED"
hss-Trigger2ApplicationServers="42605:sip\\:d426s1mtastermrg.routingcore.imsw..it;call=term;lr:SESSION_TERMINATED"
hss-Trigger2ApplicationServers="42607:sip\\:d426s1mtastermnr.routingcore.imsw..it;call=term;lr:SESSION_TERMINATED"
hss-DefaultApplicationServer="sip:d426s1mtasorig.routingcore.imsw..it;lr"
hss-DefaultASHandling="SESSION_TERMINATED"
hss-DsaiCapability=false
答え1
lr:
sedに行末を二重引用符で置き換えるように指示します。
sed -e 's/lr:$/&"/'
# ^ ^
# | |
# End of |
# line The whole
# matching part