#!/bin/bash
# to get a list of pdf files included in a tex file
# echo "Usage: $0 {file.name}"
# echo "Processing file $1"
EXPECTED_ARGS=1
E_BADARGS=65
if [ $# -ne $EXPECTED_ARGS ]
then
echo "Usage: `basename $0` {tex.file}"
exit $E_BADARGS
fi
tmpfile=`mktemp -p . exttmp.XXXX`
grep includegraphics $1 > $tmpfile
# sed -e 's/includegraphics/ /' -e 's/[\\{}]//g' -e 's/\[.*\]//g' -e 's/[^ ]\+//' -e 's/^ \+//' < $tmpfile
# this one is much better than the above
sed -e 's/.*{\(.*\.pdf\)}.*/\1/' < $tmpfile
if [ -f "$tmpfile" ]
then
rm "$tmpfile"
fi
tmpfile=`mktemp -p . exttmp.XXXX`grep includegraphics $1 > $tmpfilesed -e 's/includegraphics/ /' -e 's/[\\{}]//g' -e 's/\[.*\]//g' -e 's/[^ ]\+//' -e 's/^ \+//' < $tmpfileif [ -f "$tmpfile" ]thenrm "$tmpfile"fi## the includegraphics must be at the same line with the pdf or other figure files included.
No comments:
Post a Comment