• Login
Community
  • Login

Remove " quotes from tsv file

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
4 Posts 2 Posters 1.4k Views
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.
  • C
    Christopher Phillips
    last edited by Feb 3, 2020, 10:11 AM

    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
    • G
      guy038
      last edited by guy038 Feb 3, 2020, 10:46 AM Feb 3, 2020, 10:44 AM

      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
      • C
        Christopher Phillips
        last edited by Feb 3, 2020, 1:36 PM

        "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
        • G
          guy038
          last edited by Feb 3, 2020, 2:58 PM

          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
          2 out of 4
          • First post
            2/4
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors