아래와 비슷한 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