home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / text / tex / 13371 < prev    next >
Encoding:
Text File  |  1992-11-20  |  1.5 KB  |  47 lines

  1. Newsgroups: comp.text.tex
  2. Path: sparky!uunet!mcsun!sun4nl!ruuinf!piet
  3. From: piet@cs.ruu.nl (Piet van Oostrum)
  4. Subject: Re: how many pages in a dvi file
  5. Sender: network-news@cs.ruu.nl
  6. Message-ID: <1992Nov20.160634.24471@cs.ruu.nl>
  7. In-Reply-To: BNB@MATH.AMS.ORG (bbeeton)
  8. Date: Fri, 20 Nov 1992 16:06:34 GMT
  9. Reply-To: piet@cs.ruu.nl (Piet van Oostrum)
  10. References: <721931672.294909.BNB@MATH.AMS.ORG>
  11. Organization: Dept of Computer Science, Utrecht University, The Netherlands
  12. Lines: 33
  13.  
  14. >>>>> BNB@MATH.AMS.ORG (bbeeton) (BB) writes:
  15.  
  16. BB> we frequently receive dvi files that are to be printed on one of
  17. BB> our typesetters.  it would be quite useful to be able to determine
  18. BB> quickly how many pages are in a particular dvi file.
  19.  
  20. BB> it shouldn't be difficult to extract from dvitype the code to
  21. BB> perform this check.  but (1) we don't want to reinvent any wheels,
  22. BB> and (2) we haven't really got the time.  if anyone out there has
  23. BB> already created such a utility, we'd really appreciate learning
  24. BB> about it.
  25.  
  26. Here is something from one of the shell scripts I have:
  27.  
  28.   ( dvips $DVIF > $TMP1 ) 2> $TMP2
  29.  
  30.   COUNT=`awk '
  31.   {
  32.     for ( i = 1 ; i <= NF ; i++ )
  33.     {
  34.       if ( $i ~ / *\[[0-9]+\] */ )
  35.       {
  36.         Count++ ;
  37.       }
  38.     }
  39.   }
  40.   END { printf "%d", Count }
  41.   ' $TMP2`
  42. -- 
  43. Piet* van Oostrum, Dept of Computer Science, Utrecht University,
  44. Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands.
  45. Telephone: +31 30 531806   Uucp:   uunet!mcsun!ruuinf!piet
  46. Telefax:   +31 30 513791   Internet:  piet@cs.ruu.nl   (*`Pete')
  47.