Hey guys,

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"


In reply to Perl noob is lost by sensesfail

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.