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

Re: [PBML] Perl Question

Expand Messages
  • 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 1 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.