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

Re: [Clip] parse specific words from file

Expand Messages
  • Don - htmlfixit.com
    Give this a rip ;*** Effort by Don Passenger ;*** don@htmlfixit.com ;*** discuss things live in chat at http://htmlfixit.com
    Message 1 of 3 , Jun 1, 2005
      Give this a rip


      ;*** Effort by Don Passenger
      ;*** don@...
      ;*** discuss things live in chat at http://htmlfixit.com
      ;*******************************************************
      ;clean up a depth log file

      ; always start at the top of the document
      ^!Jump DOC_START

      ;loop for each log entry
      :LoopClean
      ;set cursor position
      ^!Set %row%="^$GetRow$"
      ^!Set %column%="^$GetCol$"

      ;***************************
      ;find to end of splicestation
      ;and delete it
      ;find the next SpliceStation^P
      ^!Find "SpliceStation^P" TIS

      ;quit when no more matches
      ^!IfError FinalStep

      ;get us to the end of the find
      ;meaning start of line we care about
      ^!Jump Select_End

      ;delete to prior cursor position
      ^!SelectTo ^%row%:^%column%

      ^!Keyboard DELETE

      ;set cursor position
      ^!Set %row%="^$GetRow$"
      ^!Set %column%="^$GetCol$"

      ;****************************
      ;get rid of everything before
      ;the depth
      ;find the next space
      ^!Find " " TIS
      ;quit when no more matches
      ^!IfError Finish

      ;get us to the end of the find
      ^!Jump Select_End

      ;delete to prior cursor position
      ^!SelectTo ^%row%:^%column%

      ^!Keyboard DELETE


      ;*****************************
      ;get us after the depth and
      ;find to the well log curve name
      ;find the next space
      ^!Find " " TIS
      ;quit when no more matches
      ^!IfError Finish

      ;get us to the end of the find
      ^!Jump Select_Start

      ;set cursor position
      ^!Set %row%="^$GetRow$"
      ^!Set %column%="^$GetCol$"

      ;find the next tilde ~
      ^!Find "~" TIS
      ;find the next then back up to a space
      ^!Find " " CIBS

      ;delete to prior cursor position
      ^!SelectTo ^%row%:^%column%

      ^!Keyboard DELETE

      ;find the next tilde ~
      ^!Find "~" TIS
      ^!Keyboard SPACEBAR

      ;repeat again
      ^!Goto LoopClean

      :FinalStep
      ^!Jump Doc_End
      ;delete to prior cursor position
      ^!SelectTo ^%row%:^%column%
      ^!Keyboard DELETE BACKSPACE
    • Mr. Phillip Sand Hansel II
      Don: It is brilliant, works flawlessly. You understood some things that I forgot to mention in my original plea. You realized that there can be more than 3
      Message 2 of 3 , Jun 2, 2005
        Don:
        It is brilliant, works flawlessly. You understood some things that I
        forgot to mention in my original plea. You realized that there can
        be more than 3 entries and the looping handles that. You picked up
        on the keywords and symbols and use them for data delimiters. Your
        EFFORT also pointed out what I was missing on my variable
        assignment, I ommitted the double quotes around the right side of
        the equation.

        I spent about five hours on this yesterday and did not come up with
        something that even worked, much less something this elegant. You
        even commented the code so I could try to understand it.

        PS. Your comments make it sound like you know about wells and logs,
        but if not, this is what it is all about...

        http://philliphansel.com/well_logs/wsr/

        specifically...

        http://philliphansel.com/well_logs/wsr/splice.htm

        In the process of joining curve segments together, the text file you
        helped me with is generated. In the last part of my workflow,
        comments are added to the oputput file. I will use the results of
        your effort to painlessly reformat the splicing comments.


        Thank you very much,
        Mr. Phillip

        NoteTab Rules!




        --- In ntb-clips@yahoogroups.com, "Don - htmlfixit.com" <don@h...>
        wrote:
        > Give this a rip
        >
        >
        > ;*** Effort by Don Passenger
        > ;*** don@h...
        > ;*** discuss things live in chat at http://htmlfixit.com
        > ;*******************************************************
        > ;clean up a depth log file
        >
        > ; always start at the top of the document
        > ^!Jump DOC_START
        >
        > ;loop for each log entry
        > :LoopClean
        > ;set cursor position
        > ^!Set %row%="^$GetRow$"
        > ^!Set %column%="^$GetCol$"
        >
        > ;***************************
        > ;find to end of splicestation
        > ;and delete it
        > ;find the next SpliceStation^P
        > ^!Find "SpliceStation^P" TIS
        >
        > ;quit when no more matches
        > ^!IfError FinalStep
        >
        > ;get us to the end of the find
        > ;meaning start of line we care about
        > ^!Jump Select_End
        >
        > ;delete to prior cursor position
        > ^!SelectTo ^%row%:^%column%
        >
        > ^!Keyboard DELETE
        >
        > ;set cursor position
        > ^!Set %row%="^$GetRow$"
        > ^!Set %column%="^$GetCol$"
        >
        > ;****************************
        > ;get rid of everything before
        > ;the depth
        > ;find the next space
        > ^!Find " " TIS
        > ;quit when no more matches
        > ^!IfError Finish
        >
        > ;get us to the end of the find
        > ^!Jump Select_End
        >
        > ;delete to prior cursor position
        > ^!SelectTo ^%row%:^%column%
        >
        > ^!Keyboard DELETE
        >
        >
        > ;*****************************
        > ;get us after the depth and
        > ;find to the well log curve name
        > ;find the next space
        > ^!Find " " TIS
        > ;quit when no more matches
        > ^!IfError Finish
        >
        > ;get us to the end of the find
        > ^!Jump Select_Start
        >
        > ;set cursor position
        > ^!Set %row%="^$GetRow$"
        > ^!Set %column%="^$GetCol$"
        >
        > ;find the next tilde ~
        > ^!Find "~" TIS
        > ;find the next then back up to a space
        > ^!Find " " CIBS
        >
        > ;delete to prior cursor position
        > ^!SelectTo ^%row%:^%column%
        >
        > ^!Keyboard DELETE
        >
        > ;find the next tilde ~
        > ^!Find "~" TIS
        > ^!Keyboard SPACEBAR
        >
        > ;repeat again
        > ^!Goto LoopClean
        >
        > :FinalStep
        > ^!Jump Doc_End
        > ;delete to prior cursor position
        > ^!SelectTo ^%row%:^%column%
        > ^!Keyboard DELETE BACKSPACE
      Your message has been successfully submitted and would be delivered to recipients shortly.