Delete multiple pages in a DjVu document with djvm #
djvm (a command line tool bundled with DjVuLibre), does not accept multiple pages or page ranges for the delete argument. Here are a few workarounds for deleting all pages in a range, even pages, or odd pages:
- Delete pages 1-42
for i in $(jot 42 1) ; do djvm -d file.djvu 1 ; done
- Delete pages 441-449
count=441 ; until [ $count -gt 449 ] ; do djvm -d file.djvu 441 ; count=`expr $count + 1` ; done
- Delete even pages 204 to 2
for (( COUNTER=204; COUNTER>=2; COUNTER-=2 )) ; do djvm -d file.djvu $COUNTER ; done
- Delete odd pages 329 to 105
for (( COUNTER=329; COUNTER>=105; COUNTER-=2 )) ; do djvm -d file.djvu $COUNTER ; done
Many thanks to DutchDaemon and s0xxx for their answers in this thread, and to SilentGhost for this answer on Stack Overflow.
/nix | Feb 15, 2010
Subscribe or visit the archives.