sensesfail has asked for the wisdom of the Perl Monks concerning the following question:
I've been put on a project to add page descriptions to thousands of documents and we're currently doing it manually and it is gruesome. I've been trying to learn Perl to write a script to do all of these files at once but I'm having a hard time. Any help would be appreciated!
Basically I have a directory with a ton of .ATT and .PDF files. ex 123.ATT and 123.PDF corresponding pdf file.
I was thinking that the script would read the 3 variables page_id, site_code and subject_id and check if it follows the rules before it would proceed.
Something along the lines of:
1) if any of the 3 variables have a blank then it would skip it
2) if it has a "?" in it. Any of the 3 variables has a question mark in any position. subject_id= 231?23422. or site_code=12? it would skip it.
Finally once it passes the criteria it would read the page_id=### and then enter the corresponding "some text" into the page_description="some text".
Such as 27.### ( I'm assuming # is a wild card for any number) = information 1
28.### = information 2.
I would like to autofill the page description depending on the page_id.
The document is formatted this way.
OBJECT=(removed) page_id=#### (usually 3-5 digits) page_description= product=(removed) study_number=(removed) content_provider=(removed) site_code=### subject_id=######### CONTENT=test.pdf SAVE
(not necessary but great if you can do it) If it can save the new file in a folder such as "resolved" and move a copy of the original in a folder called "original"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl noob is lost
by ig (Vicar) on Apr 05, 2009 at 08:52 UTC | |
by sensesfail (Initiate) on Apr 05, 2009 at 15:48 UTC | |
by ig (Vicar) on Apr 05, 2009 at 18:29 UTC | |
by sensesfail (Initiate) on Apr 06, 2009 at 01:24 UTC | |
by ig (Vicar) on Apr 06, 2009 at 21:10 UTC | |
|
Re: Perl noob is lost
by Anonymous Monk on Apr 05, 2009 at 08:33 UTC |