Community
    • Login

    Need to, in steps, copy/cut/paste

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    4 Posts 2 Posters 453 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.
    • Bertil WallmanB
      Bertil Wallman
      last edited by

      Hi!

      I’m only reaching out to see if my problem could be solved with Notepad++. Otherwise i need to check other solutions.

      I’ve downloaded a software i would like to try out but it does not come in my native swedish language, and no surprice, there are 3 huge files with each around 13000 rows to translate. :o

      To my problem.

      1. I’m trying to use Notepad++ to copy what ever is in the noteID (nid) to the notestring (nstr).
      2. Now when the nid and the nstr are identical i then need to remove/save nid (temporarly to another location/notepad) in order to be able to translate the nstr into swedish which im quickly doing with google translate (i will correct the far lesser percentage faults later). Why i need to remove nid is because when i do a translate ‘batch-style’ both nid and nstr will be translated, and that cannot happen.
      3. When nstr is translated i then need to put back/add the nid what i previously in step 2 removed, back to where it previously was locate (the row over nstr) which the software use to work properly.

      If i’ve complicated things with my steps above then feel free to advice me a better way.

      Example:
      1.
      nid “Name”
      nstr “”

      nid “Address”
      nstr “”

      nid “City”
      nstr “”

      nid “E-mail address”
      nstr “”

      nid “Phone number”
      nstr “”

      nid “Name”
      nstr “Name”

      nid “Address”
      nstr “Address”

      nid “City”
      nstr “City”

      nid “E-mail address”
      nstr “E-mail address”

      nid “Phone number”
      nstr “Phone number”

      nid “Name”
      nstr “Namn”

      nid “Address”
      nstr “Adress”

      nid “City”
      nstr “Stad”

      nid “E-mail address”
      nstr “E-postadress”

      nid “Phone number”
      nstr “Telefon nummer”

      Any help appreciated.
      Thanks.

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @Bertil Wallman
        last edited by PeterJones

        @Bertil-Wallman ,

        Make a backup of your data in case something goes wrong.

        1. duplicate string contents
          • FIND WHAT = (?-s)^nid (".*")\r\nnstr ""
            REPLACE WITH = nid $1\r\nnstr $1
            SEARCH MODE = Regular Expression
          • REPLACE ALL
        2. Number the lines:
          • Ctrl+Home
          • Edit > Begin/End Select in Column Mode
          • Ctrl+End
          • If you aren’t at the end of a line, hit ENTER to create a new blank line at the end of the document
          • Edit > Begin/End Select in Column Mode to finish the column selection – you should have a tall, super-thin rectangle selected
          • Type a space character to indent by one
          • Down Arrow to leave column-selection, then left arrow to get to the left edge of the last line
          • Edit > Begin/End Select in Column Mode
          • Ctrl+Home
          • Edit > Begin/End Select in Column Mode to end selection, again giving a zero-width but tall selection
          • Alt+C (or Edit > Column Editor) to pop up the Column Editor dialog.
          • Insert number, initial = 1, increase = ``, leading = None
          • the file should be numbered, with one or more spaces to the right of each number (depending on the number of digits)
        3. Bookmark and cut the nstr lines
          • Ctrl+M (Search > Mark)
          • FIND WHAT = \bnstr\b (the \b make sure that nstr will be a whole word, not part of some other word)
            ☑ BOOKMARK LINE
            MARK ALL
          • There should now be a dot on each line with nstr highlighted
            54353888-fd7b-4808-a67b-e686cf34f1c1-image.png
          • Search > Bookmark > Cut Bookmarked Lines
        4. Put the nstr lines in a new doc
          • Ctrl+N
          • Ctrl+V
        5. Outside of Notepad++: Translate that new document (making sure they are still numbered; spaces don’t matter, as long as there’s at least one space after the number)
        6. Copy the translated lines
        7. Paste at the end of your original document (which currently just has numbered nid lines)
        8. Edit > Line Operations > Sort Lines as Integers Ascending
        9. remove the line numbering
          • FIND WHAT = ^\d+\h+
            REPLACE WITH = delete the field, so you will replace with empty string
            SEARCH MODE = Regular Expression
            REPLACE ALL
        Bertil WallmanB 1 Reply Last reply Reply Quote 2
        • Bertil WallmanB
          Bertil Wallman @PeterJones
          last edited by

          @PeterJones
          Hi Peter…

          A huge thank you to a very well done job, i cannot thank you enough. Your instructions worked like a charm with some minor tweaks on the regex you gave me…

          1. (?-s)^nid (".“)\r\nnstr “”* didn’t work for me, so i tried it bit by bit and this > (?-s)^nid (".”)\nnstr “”* worked much better.
          2. That instruction… "initial = 1, increase = ``, leading = none… the increase part didn’t work for me either, the box didn’t allow me to add those characters, so when i tried without i only got 1’s all the way down… that didn’t work so the most logic for me was to give increase the value of 1, then it worked.
          3. And that \bnstr \b didn’t work too, so i removed the last \b then i was back on track. :)

          I was slightly curious about how the end would look like, but there was no problems at all… everything went smooth as butter… :)

          But i had some other problems with the file to deal with first, after copying some rows in the beginning i noticed the english was messed up, where 450 rows were not inside the quotation marks… like this…

          nid “”
          “Are you sure”
          “you want to clear the reportings”
          nstr “”

          nid “”
          “Are you sure”
          “you want to clean”
          “up duplicates”
          nstr “”

          nid “”
          “Are you sure”
          "you want to “clear”\ or “save”
          “expired items”
          nstr “”

          nid “”
          “Are you sure”
          “you want to”
          “clear offensive”
          “items”
          nstr “”

          so i needed to take care that first… removing all the extra quotation marks… when i did that i noticed half way in the file im editing everything wrong… you see i removed all the quotation marks, even those inside sentences (“%s” and target=“_blank”)… which is bad… so i had to start all over again… it was the first step of 4 instead of 3.

          Ja, ja… as we say here… “When head is stupid, body will suffer” (hence the unnecessary extra job)… :/

          A huge thx again Peter… :)

          PeterJonesP 1 Reply Last reply Reply Quote 0
          • PeterJonesP
            PeterJones @Bertil Wallman
            last edited by

            @Bertil-Wallman said in Need to, in steps, copy/cut/paste:

            @PeterJones
            Hi Peter…

            1. (?-s)^nid (".“)\r\nnstr “”* didn’t work for me, so i tried it bit by bit and this > (?-s)^nid (".”)\nnstr “”* worked much better.

            Notepad++ is a Windows text editor, so assuming Windows line endings is natural, and works for the majority of the people; if you had mentioned that you were using Linux line endings, I would have customized the expression for your actual data.

            1. That instruction… "initial = 1, increase = ``, leading = none… the increase part didn’t work for me either, the box didn’t allow me to add those characters,

            That was a typo on my part. It should have said “increase = 1” – I just missed the 1 in between the ` characters for trying to make the 1 red like 1 .

            1. And that \bnstr \b didn’t work too, so i removed the last \b then i was back on track. :)

            There was no space between the str and the \b in my example. In my testing, I literally used \bnstr\b and it worked. If you used \bnstr \b, it would not work, because the next character after the space is a " , and between the space and the quote mark is not a word-boundary.

            But i had some other problems with the file to deal with first, …

            Glad you figured it out.

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