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

RE: [NTB] Need help with replacing tabs in text file!

Expand Messages
  • John Shotsky
    Tabs: ^!Replace t ARSW ^!IfError Next Else Skip_-1 Not clear what you want to do with the double quotes, but you have to escape them like [ ] if you
    Message 1 of 4 , Jun 29, 2013
    View Source
    • 0 Attachment
      Tabs:
      ^!Replace "\t" >> "" ARSW
      ^!IfError Next Else Skip_-1

      Not clear what you want to do with the double quotes, but you have to escape them like [\"] if you want to do something with them.
      I'm copying this to the clip group, which is where such things are usually discussed.

      Regards,
      John
      RecipeTools Web Site: <http://recipetools.gotdns.com/> http://recipetools.gotdns.com/
      John's Mags Yahoo Group: <http://groups.yahoo.com/group/johnsmags/> http://groups.yahoo.com/group/johnsmags/

      From: notetab@yahoogroups.com [mailto:notetab@yahoogroups.com] On Behalf Of blade102071
      Sent: Friday, June 28, 2013 21:04
      To: notetab@yahoogroups.com
      Subject: [NTB] Need help with replacing tabs in text file!


      I have a text file with lines like the following:

      "INSERT INTO DBTable VALUES (""" """,""" 1 """,""" 9 """,""" E """,""" 1 """,""" """,""" """,""" U """,""" 32 """,""" """,""" 1
      """,""" 0 """,""" 0 """,""" """,""" """,""" """);"
      "INSERT INTO DBTable VALUES (""" """,""" 1 """,""" 9 """,""" E """,""" 2 """,""" """,""" """,""" U """,""" 32 """,""" """,""" 1
      """,""" 0 """,""" 0 """,""" """,""" """,""" """);"
      "INSERT INTO DBTable VALUES (""" """,""" 1 """,""" 9 """,""" E """,""" 3 """,""" """,""" """,""" U """,""" 32 """,""" """,""" 1
      """,""" 0 """,""" 0 """,""" """,""" """,""" """);"

      I am desperately trying to write a clip that will find and replace all of the tabs with blanks. ie. find tabs and replace with
      nothing.

      Also the double quotes are messing with the REPLACE syntax.

      I have tried all kinds of things and can not make either work!

      At this time the "replace tab" code takes priority.

      Help please!!



      [Non-text portions of this message have been removed]
    • Axel Berger
      ... Sorry, John, wrong. In a Replace command the quotes around terms are required and the double quote is the way to write nothing , i.e. delete. The IfError
      Message 2 of 4 , Jun 29, 2013
      View Source
      • 0 Attachment
        John Shotsky wrote:
        > Tabs:
        > ^!Replace "\t" >> "" ARSW
        > ^!IfError Next Else Skip_-1
        >
        > Not clear what you want to do with the double quotes, but you have
        > to escape them like [\"] if you want to do something with them.

        Sorry, John, wrong. In a Replace command the quotes around terms are
        required and the double quote is the way to write "nothing", i.e.
        delete.
        The IfError is superfluous here, The All in Whole document is guranteed
        to get them all in one go. There are sitiuations where Find terms can
        overlap. Then you need to give it another go to be sure, but not here.

        Axel
      • John Shotsky
        Axel, Meant to respond much sooner, but lost track. Anyway, I don t know what you meant about the double quotes, I included them in my regex, as I always do.
        Message 3 of 4 , Jul 9, 2013
        View Source
        • 0 Attachment
          Axel,
          Meant to respond much sooner, but lost track.
          Anyway, I don't know what you meant about the double quotes, I included them in my regex, as I always do. Maybe it was something in
          the original source that you're referring to, but as I used them, we are only looking for the tabs. I never write any clips without
          the double quotes, and almost every new clip is created from copying another one and only changing what is necessary.
          And, for single characters, you are right about the loop, but most of the time, I�m not doing single characters, and without the
          loop, it won't go back and repeat the process on that same line if needed. So, you are right that it is not necessary in this case,
          but it also does no harm, and it is a habit that I find easier to remember than leaving it out and then troubleshooting, only to
          discover I left out the loop.

          Regards,
          John
          RecipeTools Web Site: <http://recipetools.gotdns.com/> http://recipetools.gotdns.com/
          John's Mags Yahoo Group: <http://groups.yahoo.com/group/johnsmags/> http://groups.yahoo.com/group/johnsmags/

          From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of Axel Berger
          Sent: Saturday, June 29, 2013 07:37
          To: ntb-clips@yahoogroups.com
          Subject: Re: [Clip] RE: [NTB] Need help with replacing tabs in text file!


          John Shotsky wrote:
          > Tabs:
          > ^!Replace "\t" >> "" ARSW
          > ^!IfError Next Else Skip_-1
          >
          > Not clear what you want to do with the double quotes, but you have
          > to escape them like [\"] if you want to do something with them.

          Sorry, John, wrong. In a Replace command the quotes around terms are
          required and the double quote is the way to write "nothing", i.e.
          delete.
          The IfError is superfluous here, The All in Whole document is guranteed
          to get them all in one go. There are sitiuations where Find terms can
          overlap. Then you need to give it another go to be sure, but not here.

          Axel



          [Non-text portions of this message have been removed]
        • Axel Berger
          ... Rightly so, I falsely read your own (correct) Command as a quote and applied your comment about the need to escape quotes to it. I didn t see the real
          Message 4 of 4 , Jul 9, 2013
          View Source
          • 0 Attachment
            John Shotsky wrote:
            > I don't know what you meant about the double quotes,

            Rightly so, I falsely read your own (correct) Command as a quote and
            applied your comment about
            the need to escape quotes to it. I didn't see the real quote because you
            top posted.

            My mistake, ignore the remark where I insisted your own correct Command
            was indeed correct.

            Axel
          Your message has been successfully submitted and would be delivered to recipients shortly.