Community
    • Login

    How to fix newline and quotation mark

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    8 Posts 5 Posters 2.8k Views 1 Watching
    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 Offline
      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 Offline
        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 Offline
          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 Offline
            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 Offline
              Alan Kilborn
              last edited by

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

                @Ekopalypse it works! Wonderful! Thanks :)

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

                  Thanks, it helps me out.

                  1 Reply Last reply Reply Quote 0
                  • Prahlad-Makwana4145P Offline
                    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

                    Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                    Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                    With your input, this post could be even better 💗

                    Register Login
                    • First post
                      Last post
                    The Community of users of the Notepad++ text editor.
                    Powered by NodeBB | Contributors