View Full Version : [all variants] [SOLVED] Terminal access to File attributes
JohnGalt131
September 22nd, 2008, 05:12 PM
I need a way to determine the number of pages of a pdf by running a command in the terminal. If I right click the file and go to properties>Document, I can see how many pages there are but I need a script to automatically pass that value as an argument. So, what command does nautilus execute to determine that information?
Thanks
Mornedhel
September 22nd, 2008, 05:15 PM
You'll want pdfinfo.
JohnGalt131
September 22nd, 2008, 05:34 PM
You'll want pdfinfo.
Thank you.
Do you perhaps know how to send only the 6th field to stdout?
JohnGalt131
September 22nd, 2008, 05:35 PM
Oh, wait.
pdfinfo file.pdf | grep Pages.
but then how do I get Only the value 2, or whatever the number is?
Mornedhel
September 22nd, 2008, 05:42 PM
pdfinfo your_document.pdf | grep Pages will output something like
"Pages : 357"
If you want only the 357 to show, you will need a bit of sed :
pdfinfo your_document.pdf | grep Pages | sed 's/[^0-9]*//g'
JohnGalt131
September 22nd, 2008, 05:43 PM
pdfinfo your_document.pdf | grep Pages will output something like
"Pages : 357"
If you want only the 357 to show, you will need a bit of sed. I'm afraid I need to read up on sed myself...
You have helped immensely, thank you!
Mornedhel
September 22nd, 2008, 05:45 PM
Sorry, I edited my above reply but you were too quick.
Powered by vBulletin® Version 4.2.2 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.