Question on perl script.

Discussion in 'Perl Misc' started by Unix_Shell, Mar 29, 2005.

  1. Unix_Shell

    Unix_Shell Guest

    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
     
    Unix_Shell, Mar 29, 2005
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Wet Basement
    Replies:
    1
    Views:
    2,593
    BobMonk
    Jul 15, 2003
  2. dpackwood
    Replies:
    3
    Views:
    1,872
  3. pj
    Replies:
    3
    Views:
    325
  4. Petterson Mikael

    Execute another perl script from my perl script

    Petterson Mikael, Jan 5, 2005, in forum: Perl Misc
    Replies:
    3
    Views:
    155
    Paul Lalli
    Jan 5, 2005
  5. Replies:
    20
    Views:
    887
    Gunnar Hjalmarsson
    Jan 18, 2005
Loading...

Share This Page