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

parse specific words from file

Expand Messages
  • Mr. Phillip Sand Hansel II
    Greetings: Although I have created a few clips, what I want to do now is beyond my knowledge, and I can t quite seem to find a similar example and modify it to
    Message 1 of 3 , Jun 1, 2005
      Greetings:

      Although I have created a few clips, what I want to do now is beyond
      my knowledge, and I can't quite seem to find a similar example and
      modify it to meet my needs (I have tried).

      I would like to take values out of a file and create a new file with
      those words.

      -- An example input file --
      3
      SpliceStation
      1.05 4190.5 SmartValue
      1.1 IMPHED~
      0 13
      SpliceStation
      1.05 5743 SmartValue
      1.1 ILMED~
      0 10
      SpliceStation
      1.05 12507.5 SmartValue
      1.1 IMPHED~
      0 13
      -- end of example --

      -- desired result file --
      4190.5 IMPHED 5743 ILMED 12507.5 IMPHED
      -- end of desire --

      I want to get the second field of the third line (a depth value),
      and the second field of the fourth line (a well log curve name), and
      then get the second field of the 7th and 8th lines, etc... and place
      them in a file as one line of depth/curvename depth/curvename etc...

      I have tried something like...
      ; 1st depth curve pair
      ^$GetField(3;2)$
      ^$GetField(4;2)$

      But all I am getting is confused. I have been manually cutting and
      pasting the needed text, but I know there is a better way. Any ideas?

      Thanks in advance,
      Mr. Phillip
    • Don - htmlfixit.com
      Give this a rip ;*** Effort by Don Passenger ;*** don@htmlfixit.com ;*** discuss things live in chat at http://htmlfixit.com
      Message 2 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 3 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.