Community
    • Login

    How to fix newline and quotation mark

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    8 Posts 5 Posters 1.8k 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.
    • Andy LightA
      Andy Light
      last edited by

      Hi. I have csv-file with separators by comma. And there are few lines that unlike from others. They divided into new lines by some reason.

      In file:

      "word1","word2
      ","word3
      ","word4
      "
      "nextword1","nextword2
      ","nextword3
      ","nextword4
      "
      

      What I need:

      "word1","word2","word3","word4"
      "nextword1","nextword2","nextword3","nextword4"
      

      Can anyone help me to fix this please?

      EkopalypseE 1 Reply Last reply Reply Quote 1
      • EkopalypseE
        Ekopalypse @Andy Light
        last edited by Ekopalypse

        @Andy-Light

        without knowing what caused it is hard to tell what needs to be done.
        Did you use View->Show Symbols->Show all characters to see
        what has been inserted?

        Andy LightA 1 Reply Last reply Reply Quote 0
        • Andy LightA
          Andy Light @Ekopalypse
          last edited by

          @Ekopalypse all of lines ends with CRLF. But bugged rows ends without quotation mark.

          Here is a normal row:

          "word1","word2","word3","word4"
          

          And here is a bugged row:

          "word1","word2","word3","word4
          

          As you can see, the bugged row doesn’t have quotation mark. Maybe there is a way how to find those rows?

          EkopalypseE 1 Reply Last reply Reply Quote 0
          • EkopalypseE
            Ekopalypse @Andy Light
            last edited by

            @Andy-Light

            given the example I would say this should do it

            find what: ([^"])\r\n
            replace with: \1

            Andy LightA 1 Reply Last reply Reply Quote 3
            • Alan KilbornA
              Alan Kilborn
              last edited by

              This post is deleted!
              1 Reply Last reply Reply Quote 0
              • Andy LightA
                Andy Light @Ekopalypse
                last edited by

                @Ekopalypse it works! Wonderful! Thanks :)

                1 Reply Last reply Reply Quote 2
                • Sudeep TamrakarS
                  Sudeep Tamrakar
                  last edited by

                  Thanks, it helps me out.

                  1 Reply Last reply Reply Quote 0
                  • Prahlad-Makwana4145P
                    Prahlad-Makwana4145
                    last edited by

                    Hello, @Andy-Light

                    Please follow below steps :

                    Step 1:- Find (in regular expression mode) (.+)
                    Step 2:- Replace with: "/1"
                    Step 3:- This adds the quotes :

                    "word1"
                    "word2"
                    "word3"
                    "word4"
                    

                    Step 4:- Find (in extended mode): /r/n
                    Step 5:- Replace with (with a space after the comma, not shown): ,
                    Step 6:- This converts the lines into a comma-separated list:
                    "word1", "word2", "word3", "word4"

                    I hope above information will be useful for you.
                    Thank you.

                    1 Reply Last reply Reply Quote 2
                    • First post
                      Last post
                    The Community of users of the Notepad++ text editor.
                    Powered by NodeBB | Contributors