Declan Grady stated:
< I have a list of folder full of pdf files, of which I regularly create a
< html list of name, date and size. - after a bit of fiddling, this awk
< command seems to work
<
< ls -l | awk '{print "<a
< href=\"http://www.nuvotem.com/en/products/pdf/"$9"\">"$9"</a>","<br>Date:
< "$7"-"$6"-"$8,"<br>Size: "$5" bytes \n\n\n<br><br>"}'
< >>/home/declan/pdflist.html
<
< This gives me an output like so : (full list at
< http://www.nuvotem.com/pdflist.html )
<
< <a href="http://www.nuvotem.com/en/products/pdf/AC1005.pdf">AC1005.pdf</a>
< <br>Date: 11-Jan-14:10 <br>Size: 55595 bytes <br><br>
< <a href="http://www.nuvotem.com/en/products/pdf/AC1010.pdf">AC1010.pdf</a>
< <br>Date: 11-Jan-14:10 <br>Size: 52907 bytes <br><br>
< .... etc etc
<
< 3 questions:
< 1. How can I get the date format to show 11-Jan-2002 instead of 11-Jan-14:10
< ?
Since you're parsing ls output, you won't get it.
Use perl and her stat function.
< 2. How can I *easily* get the "description" from the pdf "document info"
< from each pdf file ?
use the perl PDF::Parse module ( http://search.cpan.org/search?mode=module&query=pdf )
eg:
use PDF:Parse;
$pdf -> TargetFile($filename);
$pdf->LoadPageInfo;
.. etc...
see http://search.cpan.org/doc/ANTRO/PDF-111/PDF/Parse.pm
< 3. How *should* I have gone about achieving this, considering I'm no
< programmer ?
use perl ;-)
<
< Thanks,
< Declan
< [NODIS]
<
<
<
< --
< Irish Linux Users' Group: ilug at linux.ie
< http://www.linux.ie/mailman/listinfo/ilug for (un)subscription information.
< List maintainer: listmaster at linux.ie
--
Sean.
.
At the mo its Old Town - PHIL LYNOTT
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!