Skip to main content

match curly braces {} with sed [Resolved]

I want to remove \includegraphics from .tex files in order to get a list of the filenames as illustrated in the following example. I want to remove x and y and get I

something {\includegraphics[width=0.5\textwidth]{/tmp/myfile.pdf} somethingelse

The following example does not work with GNU sed 4.5. How should I escape the braces properly, so that it matches properly?

echo "something {\includegraphics[width=0.5\textwidth]{" | sed -e "s/^*.\\includegraphics\[*.\]\{//"

Question Credit: Jonas Stein
Question Reference
Asked July 20, 2019
Posted Under: Unix Linux
1 Answers

Your Answer