#!/bin/bash
#Check for latex document $1 whether all included graphics are present in the SVN.
rm -f /tmp/available_files /tmp/included_figures
grep -P -o "^[^\%].*includegraphics\s*(\[[^\]]*\])?\s*{([^}]+)}" $1 | \
sed 's/^.*includegraphics.*{\(.*\)}/\1/g' > /tmp/included_figures
#files already in the repository
svn ls --recursive >> /tmp/available_files
#files just added or copied
svn status | grep -P "^A[ +]+" | sed 's/A\([ +]\)*//g' >> /tmp/available_files
for name in `cat /tmp/included_figures`; do
if !(grep -P --quiet "^$name(\.pdf|\.eps|\.png|\.jpg|\.ps|\.PDF|\.EPS|\.PNG|\.JPG|\.PS)?$" /tmp/available_files); then
echo "$name";
fi
done
Suggestions for improvement are welcome.
--
JohannesSingler - 12 Mar 2008