Community
    • Login

    Find and copy a specific line from a file

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 530 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.
    • Mobil MeisterM
      Mobil Meister
      last edited by

      Hello dear notepad++ user,
      I have a text file,
      and the data is always in this format:

      Name: xxx
      Family name: xxx
      Date of birth: xxxxx
      Street: xxxxx
      No.: xx
      City code: xxxxxx
      City: xxxxxxxx
      Floor: xxxx
      Location: xxxxx
      Telephone: xxxxxxxx
      Email: xxxxxxxxx@xxxxxxxxxxx.xx
      IBAN: xxxxxxxxxxxx
      xxxxxxxxx

      I only want to copy the line “E-Mail” into another file,
      preferably separated by commas,

      so he should copy the content of the line e-mail: after the colon into a separate file or into the same file somewhere at the end, preferably one after the other. so

      xx@xxxxxxx, xxxxxxxx@xxxx, xxxxxx@xxxxxxx, xxxxxxxxxx@xxxx, xxxxxxx@xxxxxx,

      thanks

      Terry RT 1 Reply Last reply Reply Quote 0
      • Terry RT
        Terry R @Mobil Meister
        last edited by Terry R

        @Mobil-Meister said in Find and copy a specific line from a file:

        I only want to copy the line “E-Mail” into another file

        This is fairly simple. It can be achieved in a few steps. My thoughts were that you work on a copy of the file and use the Mark (bookmark) function.

        So once the (copied) file is opened in Notepad++ Go to “Search”, then “Mark”. You can type in Email:, select (tick) bookmark and then click “Mark All”. Note that as the text you are searching for doesn’t change your search mode can be “Normal”. Every line which has this text will be marked with a blue circle in the left margin.
        Close the Mark function and right click in the left margin and select “Remove unmarked lines”.
        You are now left with ONLY the Email lines of the file. Now you can use the Replace function. This time you will be replacing the Email: (and CR and LF) with a comma.
        So Find What: (?-s)Email:( .+)\R
        Replace With: ${1},
        This is a regular expression so set the search mode as regular expression. Click on Replace All. You should now have the result you want.

        Terry

        Mobil MeisterM 1 Reply Last reply Reply Quote 3
        • Mobil MeisterM
          Mobil Meister @Terry R
          last edited by

          @Terry-R oh my god,
          actually completely logical, i just didn’t have the idea. thank you. notepad++ is really a super tool.

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