Question on perl script.

U

Unix_Shell

Hello Group,

I am very new to the perl language and don't know much about it. I had
a question & maybe someone can help me decipher/modify a script.

We have AIX 5.2 & the script (test.sh) contains the following perl
command:

/usr/bin/perl
-014pe's|^|"'$PAGE1FORM'".(/Page:\s+1\s/?"\n":"'$CONTFORMSFX'\n")|e'

Basically, two values are being passed to this script. Variable
PAGE1FORM will contain $1 (example: "m_inv01") and CONTFORMSFX will
contain $2 (example: "_09").

Basically, the script is invoked as follows:

../test.sh m_inv01 _09 < inrptfile > outrptfile

The perl command processes the inrptfile by substituting the first line
of page 1 with m_inv01 and substituting the first line from page 2
onwards with m_inv01_09 (concatenation of $1 & $2).

Question: How can I make it substitute something completely different
from page 2 onwards? So, if I run the script as follows:

../test.sh m_inv01 pg2form < inrptfile > outrptfile

I would like the perl command to substitute the first line of page 1
with m_inv01 (just like above); however I would like it to substitute
the first line from page 2 onwards with pg2form (i.e. with whatever I
pass as $2 and *not* a concatenation of $1 and $2).

Thanks for any help.
S
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top