Find the answer to your Linux question:
Results 1 to 3 of 3
Hi all, I have a latex file and I want to replace all occurences of \eng{<utf8 characters>} with <utf8 characters>, that is remove the tex command with its delimiters \eng{} ...
  1. #1
    Just Joined!
    Join Date
    Nov 2009
    Posts
    3

    Removing latex command delimiters with sed

    Hi all,
    I have a latex file and I want to replace all occurences of \eng{<utf8 characters>} with <utf8 characters>, that is remove the tex command with its delimiters \eng{} which is around some text. I tried
    sed 's/\eng{[:alpha:]*}/&/g' input.tex > output.tex
    but does not work at all while
    sed 's/\eng//g' input.tex > output.tex
    does only remove the \eng{, leaving the trailing } after the text. Any help would be appreciated!
    filimon

  2. #2
    Linux Newbie
    Join Date
    Mar 2009
    Posts
    228
    sed 's/\\eng{\(.*\)}/\1/'

  3. #3
    Just Joined!
    Join Date
    Nov 2009
    Posts
    3
    Almost there, I need to change this so that it stops at the first } and does this for multiple \eng{...} in a line. My first change was
    sed 's/\\eng{\(.*\)}/\1/g'
    but this doesn't do it completely either. How to make sed get the first } instead of the last one in the line? Thanks,
    filimon

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...