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

Find and IfTrue

Expand Messages
  • Mr. Phillip Sand Hansel II
    Greetings: I am trying to do a conditional replace but instead am floundering about. I have a file that contains some lines which look like this... DEPT.F
    Message 1 of 2 , Dec 5, 2006
    • 0 Attachment
      Greetings:

      I am trying to do a conditional replace but instead am floundering about.

      I have a file that contains some lines which look like this...

      DEPT.F :
      GRAM.GAPI 99 310 01 00: GAMMA RAY
      RACLM.OHMM 99 000 00 00: 400-KHZ ATTENTUATION-DERIVED RESISTIVITY
      BOREHOLE CORRECTED
      RPCHM.OHMM 99 000 00 00: 2-MHZ PHASE-DIFFERENCE-DERIVED RESISTIVITY,
      BOREHOLE CORRECTED
      RPCLM.OHMM 99 000 00 00: 400-MHZ PHASE-DIFFERENCE-DERIVED RESISTIVITY,
      BOREHOLE CORRECTED
      RPCS.OHMM 99 000 00 00: 2-MHZ PHASE-DIFFERENCE-DERIVED RESISTIVITY,
      BOREHOLE CORRECTED
      AT20.OHMM 06 120 20 00: 20-IN. RESISTIVITY, 2-FT RESOLUTION
      AT10.OHMM 06 120 10 00: 10-IN. RESISTIVITY, 2-FT RESOLUTION


      The word RPCS should really be RPCSHM or RPCSLM depending on if the comment
      (to the right) says 2-MHZ or 400-KHZ (low vs. high frequency).

      I can find it with this...

      ^!Find RPCS\.OHMM.*2-MHZ R

      if that is found, I would like to do this...
      ^!Replace RPCS.OHMM RPCSHM.OHMM SIH


      I thought I could do this....
      ^!fTrue ^!Find RPCS\.OHMM.*2-MHZ R ^!Replace RPCS.OHMM RPCSHM.OHMM SIH

      But I can not seem to get that to work. I want to do a replace if the prior
      condition has been met.
      (NOTE my Replacement statement is TAB delimited, email may trash the tabs).

      I know NoteTab is able to do this, I am just having a hard time figuring out
      how to tell it what I want.

      Thanks in advance for your thoughts,
      Mr. Phillip Sand Hansel II
      http://philliphansel.com
    • Sheri
      ... ^!Find whatever RS ^!IfError FindErrorLabel ;if you get here whatever must be highlighted - your IfTrue condition ^!Replace whateverhighlighted
      Message 2 of 2 , Dec 5, 2006
      • 0 Attachment
        --- In ntb-clips@yahoogroups.com, "Mr. Phillip Sand Hansel II"
        <mr.phillip@...> wrote:

        > I can find it with this...
        >
        > ^!Find RPCS\.OHMM.*2-MHZ R
        >
        > if that is found, I would like to do this...
        > ^!Replace RPCS.OHMM RPCSHM.OHMM SIH
        >
        >
        > I thought I could do this....
        > ^!fTrue ^!Find RPCS\.OHMM.*2-MHZ R ^!Replace RPCS.OHMM RPCSHM.OHMM SIH
        >

        You will need to take things one step at a time:

        :Start
        ^!Find "whatever" RS
        ^!IfError FindErrorLabel
        ;if you get here whatever must be highlighted - your IfTrue condition
        ^!Replace "whateverhighlighted" >> "proper replacement" SIH
        ^!IfError ReplaceErrorLabel
        ;what next? Advance to next line?
        ^!Jump +1
        ;next find the next match?
        ^!Goto Start
        ;end of processing
        :FindErrorLabel
        ^!Prompt There are no more "whatevers"
        ^!Goto End
        :ReplaceErrorLabel
        ^!Prompt I guess this should never happen.
        ^!Goto End
        ;end of clip

        Hope that helps.

        Regards,
        Sheri
      Your message has been successfully submitted and would be delivered to recipients shortly.