Question on perl script.

From: Unix-Shell (sgtembe_at_hotmail.com)
Date: 03/29/05


Date: 29 Mar 2005 08:45:03 -0800

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: (the command was posted by one of the members in response to a
query few months back)

/usr/bin/perl
-014pe's|^|"'$PAGE1FORM'".(/Pa­ge:\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



Relevant Pages

  • Question on perl script.
    ... I am very new to the perl language and don't know much about it. ... two values are being passed to this script. ... The perl command processes the inrptfile by substituting the first line ... How can I make it substitute something completely different ...
    (comp.lang.perl.misc)
  • Re: Question on perl script.
    ... > I am very new to the perl language and don't know much about it. ... > a question & maybe someone can help me decipher/modify a script. ... That's a single perl command line, ... It doesn't substitute lines, it inserts ...
    (comp.lang.perl.misc)
  • Re: Question on perl script.
    ... > I am very new to the perl language and don't know much about it. ... > command: (the command was posted by one of the members in response to a ... two values are being passed to this script. ... How can I make it substitute something completely different ...
    (comp.unix.shell)
  • Re: Question on perl script.
    ... > I am very new to the perl language and don't know much about it. ... > command: (the command was posted by one of the members in response to a ... two values are being passed to this script. ... How can I make it substitute something completely different ...
    (comp.unix.shell)
  • Re: Updating NIS maps?!
    ... via a script. ... I have been trying to accomplish this via sed, Perl, ... Does anyone know of one Perl command, ...
    (comp.unix.programmer)

Quantcast