Loading ...
Sorry, an error occurred while loading the content.

Perl Question

Expand Messages
  • always.marquez
    how can i use perl to change dump_count=dump_count+0 to dump_count=$((dump_cunt+0)) can anyone help?
    Message 1 of 5 , Jul 27, 2010
    • 0 Attachment
      how can i use perl to change
      dump_count=dump_count+0

      to

      dump_count=$((dump_cunt+0))

      can anyone help?
    • Charles K. Clarkson
      ... It might be useful if you explained what you are trying to do. HTH, Charles Clarkson -- Mobile Home Investor Free Market Advocate Programmer I m not really
      Message 2 of 5 , Jul 28, 2010
      • 0 Attachment
        always.marquez wrote:
        > can anyone help?

        It might be useful if you explained what you are trying to do.


        HTH,

        Charles Clarkson
        --
        Mobile Home Investor
        Free Market Advocate
        Programmer

        I'm not really a smart person. I just play one on the Internet.

        Stephenville, TX
        +1 (254) 968-8328
      • always.marquez@gmail.com
        I m currently migrating into a new server. There are some minor changes I need to make to my shell scripts for them to work. One change is to add $(( )) to any
        Message 3 of 5 , Jul 28, 2010
        • 0 Attachment
          I'm currently migrating into a new server. There are some minor changes I need to make to my shell scripts for them to work. One change is to add $(( )) to any arithmetic. Instead of manually going into the file, I was hoping to use a Perl command to make these changes.

          An example of a Perl command that I use is
          Perl -p -i -e 's{let NUM1}{NUM1}g' file.ksh

          This changes all my "let NUM1" into just "NUM1"

          So I need a perl command that can change dump_count=$dump_count+0
          into
          dump_count=$(($dump_count+0))


          Hope this helps to clarify.


          Sent from a BlackBerry�

          -----Original Message-----
          From: "Charles K. Clarkson" <cclarkson@...>
          Sender: perl-beginner@yahoogroups.com
          Date: Wed, 28 Jul 2010 02:24:04
          To: <perl-beginner@yahoogroups.com>
          Reply-To: perl-beginner@yahoogroups.com
          Subject: Re: [PBML] Perl Question

          always.marquez wrote:
          > can anyone help?

          It might be useful if you explained what you are trying to do.


          HTH,

          Charles Clarkson
          --
          Mobile Home Investor
          Free Market Advocate
          Programmer

          I'm not really a smart person. I just play one on the Internet.

          Stephenville, TX
          +1 (254) 968-8328



          [Non-text portions of this message have been removed]
        • merlyn@stonehenge.com
          ... always So I need a perl command that can change dump_count=$dump_count+0 always into always dump_count=$(($dump_count+0))
          Message 4 of 5 , Jul 28, 2010
          • 0 Attachment
            >>>>> "always" == always marquez <always.marquez@...> writes:

            always> So I need a perl command that can change dump_count=$dump_count+0
            always> into
            always> dump_count=$(($dump_count+0))

            s{dump_count=\$dump_count+0}{dump_count=\$((\$dump_count+0))};

            Or, if that's just an example instead of a literal change, you
            need to spell out the rules, not just give an example.

            --
            Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
            <merlyn@...> <URL:http://www.stonehenge.com/merlyn/>
            Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
            See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
          • Marquez
            Here is what i got when i attempted to use what you suggested $ perl -p -i -e s{DUMP_COUNT= $DUMP_COUNT+0}{DUMP_COUNT= $(( $DUMP_COUNT+0))}; main.ksh.test ksh:
            Message 5 of 5 , Jul 28, 2010
            • 0 Attachment
              Here is what i got when i attempted to use what you suggested
              $ perl -p -i -e
              s{DUMP_COUNT=\$DUMP_COUNT+0}{DUMP_COUNT=\$((\$DUMP_COUNT+0))}; main.ksh.test
              ksh: syntax error: `((' unexpected

              what am i doing wrong?




              On Wed, Jul 28, 2010 at 3:07 PM, Randal L. Schwartz
              <merlyn@...>wrote:

              > >>>>> "always" == always marquez <always.marquez@...> writes:
              >
              > always> So I need a perl command that can change dump_count=$dump_count+0
              > always> into
              > always> dump_count=$(($dump_count+0))
              >
              > s{dump_count=\$dump_count+0}{dump_count=\$((\$dump_count+0))};
              >
              > Or, if that's just an example instead of a literal change, you
              > need to spell out the rules, not just give an example.
              >
              > --
              > Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
              > <merlyn@...> <URL:http://www.stonehenge.com/merlyn/>
              > Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
              > See http://methodsandmessages.vox.com/ for Smalltalk and Seaside
              > discussion
              >

              fromalways.marquez@...
              reply-toalways.marquez@...
              toperl-beginner@yahoogroups.com
              dateWed, Jul 28, 2010 at 10:29 AM
              subjectRe: [PBML] Perl Question
              mailed-bygmail.com
              Images from this sender are always displayed. Don't display from now on.
              hide details 10:29 AM (5 hours ago)

              I'm currently migrating into a new server. There are some minor changes I
              need to make to my shell scripts for them to work. One change is to add $((
              )) to any arithmetic. Instead of manually going into the file, I was hoping
              to use a Perl command to make these changes.
              An example of a Perl command that I use is
              Perl -p -i -e 's{let NUM1}{NUM1}g' file.ksh
              This changes all my "let NUM1" into just "NUM1"
              So I need a perl command that can change dump_count=$dump_count+0
              into
              dump_count=$(($dump_count+0))

              Hope this helps to clarify.

              Sent from a BlackBerry®


              [Non-text portions of this message have been removed]
            Your message has been successfully submitted and would be delivered to recipients shortly.