Add quotation marks (") to end of specific lines using sed or awk
I have a text of 120k similar to the one below and to I want to add " (quotation marks) at the end of the lines which are finishing in lr:
. Could you please tell me how to do it using sed or 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
commit -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
Tell sed to replace lr:
at the end of a line with itself plus double quotes:
sed -e 's/lr:$/&"/'
# ^ ^
# | |
# End of |
# line The whole
# matching part