I would like to extract the highest revision number in a subversion dump file. Besides parsing the file line by line, is there any easier (and hopefully faster) way using standard perl (no extra modules allowed on the server) or bash shell scripting?
if you created a dump file using
svnadmin dump /path/to/repo > Dump1.dump
The you can find the last revision number with this one-liner:
grep --binary-files=text "Revision-number" Dump1.dump | tail -n 1 | sed 's/Revision-number\:\ //g'
Alternately to avoid grepping the entire file, use tac (cat backwards) and stop on the first (last) match. Eliminates the need for tail on the large output of grep, and saves processing time.
tac Dump1.dump | grep -m1 --binary-files=text "Revision-number" | sed 's/Revision-number\:\ //g'