I have a file plenty of text strings like
text {\LXXX} more text
where XXX can be any character and its lenght is not necessary of 3 characters. I need to replace all {\LXXX} by {\LXXX}}, i.e., add } to the end of {\LXXX}. The original text must be read then
text {\LXXX}} more text
I'm trying to do that with sed, but I'm completely lost about how to create the regexp for find and replace. Can anyone help me, please?
Xbe a}?{\LXXX}parts, and then simply replace with capture +}? For the capturing, something like({\\L[^}]+})should do.sed -E 's/(\{\\L[[:alnum:]]*\})/\1}/g'ifXXXis allowed to be zero characters long orsed -E 's/(\{\\L[[:alnum:]]+\})/\1}/g'if it has to be at least one character long. Please make your requirements chrystal clear and show us what you've tried.