Remove " quotes from tsv file



  • 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?



  • 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



  • "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
    


  • 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


Log in to reply