Community

    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Remove " quotes from tsv file

    Help wanted · · · – – – · · ·
    2
    4
    157
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Christopher Phillips
      Christopher Phillips last edited by

      I have a folder with hundred of tsv files.
      The all follow the structure

      “sourcetext”(tab)“targettext”
      “moresourcetext”(tab)“moretargettext”
      “more”“source”“text”(tab)“more”“target”“text”

      I am trying to find a way to end up with:

      sourcetext(tab)targettext
      moresourcetext(tab)moretargettext
      more"source"text(tab)more"target"text

      Any ideas how I can achieve this on all files?

      1 Reply Last reply Reply Quote 0
      • guy038
        guy038 last edited by guy038

        Hello, christopher-phillips,

        Because of Markdown syntax of this forum, some regular double-quotes (" ), in your text, may have been changed as “ and ”. So, could you rewrite your input and output text, using the button, below, to see it as code text :

        Thanks for trying

        See you later,

        Best Regards,

        guy038

        1 Reply Last reply Reply Quote 0
        • Christopher Phillips
          Christopher Phillips last edited by

          "sourcetext"(tab)"targettext"
          "moresourcetext"(tab)"moretargettext"
          "more""source""text"(tab)"more""target""text"
          
          I am trying to find a way to end up with:
          
          sourcetext(tab)targettext
          moresourcetext(tab)moretargettext
          more"source"text(tab)more"target"text
          
          1 Reply Last reply Reply Quote 0
          • guy038
            guy038 last edited by

            Hi, christopher-phillips,

            Thanks ! So, here is the road map, with a regex S/R :

            • Open the Replace dialog ( Ctrl + H )

            • SEARCH (^|(?<=\t))"|"((?=\t)|$)|"(?=")

            • REPLACE Leave EMPTY

            • Tick the Wrap around option, if necessary

            • Select the Regular expression search mode

            • Click, exclusively, on the Replace All button


            Notes :

            • This search regex contains 3 alternatives, separated with the alternation symbol | :

              • The first part (^|(?<=\t))" searches for a double quote, only if at beginning of line or preceded with a tabulation char ( \t )

              • The second part "((?=\t)|$) searches for a double quote, only if followed with a tabulation char or an end of line

              • The last part "(?=") searches for a double quote, only if followed with a second double-quote

            • As the replacement zone is Empty, the double-quote selected, whatever the alternative, is simply deleted

            Best Regards,

            guy038

            1 Reply Last reply Reply Quote 2
            • First post
              Last post
            Copyright © 2014 NodeBB Forums | Contributors