Re: get number of pages of a PostScript file
On Tue, May 01, 2001 at 03:04:41PM +0200, Iwan Mouwen wrote: * Rob Mahurin [EMAIL PROTECTED] [010428 23:09]: 10:48 $ psselect -p _1 zeeman.ps /dev/null [8] Wrote 1 pages, 86473 bytes Shouldn't that be psselect -p - file.ps /dev/null instead? [EMAIL PROTECTED]:~/tmp$ psselect -p _1 report.ps /dev/null [11] Wrote 1 pages, 68447 bytes [EMAIL PROTECTED]:~/tmp$ psselect -p - report.ps /dev/null [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] Wrote 11 pages, 100834 bytes That also works; the question was how to find out the number of pages in the document, though, so I only care about the last number. You could even do 16:28 $ psselect -p _1 xray.ps 21 /dev/null | tr [] \n\n | grep ^[0-9] 8 although I'm sure there's a more elegant way. Rob -- Text processing has made it possible to right-justify any idea, even one which cannot be justified on any other grounds. -- J. Finnegan, USC.
Re: get number of pages of a PostScript file
* Rob Mahurin [EMAIL PROTECTED] [010428 23:09]: 10:48 $ psselect -p _1 zeeman.ps /dev/null [8] Wrote 1 pages, 86473 bytes Shouldn't that be psselect -p - file.ps /dev/null instead? [EMAIL PROTECTED]:~/tmp$ psselect -p _1 report.ps /dev/null [11] Wrote 1 pages, 68447 bytes [EMAIL PROTECTED]:~/tmp$ psselect -p - report.ps /dev/null [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] Wrote 11 pages, 100834 bytes Iwan.
get number of pages of a PostScript file
What's the fastest way to do this on the command line? TIA Stony
Re: get number of pages of a PostScript file
Hello Alexander, * Alexander Steinert wrote: What's the fastest way to do this on the command line? I think there are more than thousand solutions ;-) grep ^%%Pages file.ps|awk '{ print $2 }' cya Waldemar -- * A good website for linuxsoftware:| (o_ * * http://www.freshmeat.net | //\ * * Linux rulez!;-)| V_/_ * * GnuPG-Key: 0xBE21BD90 | Tux: #155220 | ICQ: 64035650 *
Re: get number of pages of a PostScript file
On Fri, Apr 27, 2001 at 02:41:04PM +0200, Alexander Steinert wrote: What's the fastest way to do this on the command line? I do: 10:48 $ psselect -p _1 zeeman.ps /dev/null [8] Wrote 1 pages, 86473 bytes Rob -- It seems to make an auto driver mad if he misses you.
Re: get number of pages of a PostScript file
On Sat, Apr 28, 2001 at 01:17:46PM +0200, Waldemar Brodkorb wrote: Hello Alexander, * Alexander Steinert wrote: What's the fastest way to do this on the command line? I think there are more than thousand solutions ;-) grep ^%%Pages file.ps|awk '{ print $2 }' any idea why this is 2x as fast as the equivalent awk '/^%%Pages/ { print $2 }' file.ps ? -- John Lenton ([EMAIL PROTECTED]) -- Random fortune: Oh John, let's not park here. Oh John, let's not park. Oh John, let's not. Oh John, let's. Oh John. Oh. pgpT7REaBKYO5.pgp Description: PGP signature
Re: get number of pages of a PostScript file
On Sat, Apr 28, 2001 at 07:15:37PM -0300, John R Lenton wrote: grep ^%%Pages file.ps|awk '{ print $2 }' any idea why this is 2x as fast as the equivalent awk '/^%%Pages/ { print $2 }' file.ps Because grep, being a compiled program, can do file I/O faster than awk, which is interpreted. Walt pgpk8EN7WU32Z.pgp Description: PGP signature