• Home »
  • Insights »
  • Append Text To Each Line In Notepad++, Prefix Text To Every Line In Notepad++

Append Text To Each Line In Notepad++, Prefix Text To Every Line In Notepad++

Notepad++ is one of my favorite applications on Windows because of all of the functionality it provides. One thing I needed to do recently was to add text to the end of each line in a text file but I wasn’t sure exactly how to do it without a little research. Below is information on how to both append data to every line in a text file and how to prefix data to every line in a text file.

Append Data To Every Line In A Text File With Notepad++:

  1. Open Text File: First open the text file you want to append data to every line in Notepad++. In this example I have a list of 19 password hashes and passwords as shown in the below image that I want to append the hash type to the end of the file.

    Notepad++ Text File With List Of Hashes

  2. Notepad++ Search & Replace: Click Search in the top navigation bar and then scroll down to click Replace as shown in the below example image.

    Notepad++ Menu: Search & Replace

    Once you click Replace it will open the Replace tab in the Notepad++ Find window as shown below.

    Notepad++ Replace Tab In Find Window

  3. Modify Search Mode: Now you need to make sure and change the Search Mode to Regular Expression by clicking the radio button next to “Regular Expression” as shown in the below image. The Search Mode is configured in the bottom left of the Search window.

    Notepad++ Search Mode: Regular Expression

  4. Append Text: In the “Find What” field you should enter “^(.+)$” without he quotes which will find every line of text and in the “Replace With” field you will enter “\1<text to append”. The \1 is text located from the Find What field which will be followed by whatever you want to append to each line. In the example below we will be appending :SHA.

    Notepad++ Append Data To Every Line

    Once you have filled in Find What and Replace With click the Replace All button which will add the text after the 1 to every line and display a popup confirmation displaying how many lines were modified.

    Notepad++: Replace All Confirmation Popup

    The initial list of hashes will now all have :SHA at the end of each line as shown in the below example image.

    Notepad++: Data Appended To Every Line

Now save the file and data is appended to every line. If you want to prefix each line with data in Notepad++ simply add the data you want to prefix before the “\1″ in the Replace With box and then click the Replace All button to make the modification to the text file.

Mastering Regular Expressions (Paperback)

By (author): Jeffrey E. F. Friedl


List Price: $49.99 USD
New From: $26.98 USD In Stock
Used from: $18.00 USD In Stock

Regular Expressions Cookbook (Paperback)

By (author): Jan Goyvaerts, Steven Levithan


List Price: $44.99 USD
New From: $38.99 USD In Stock
Used from: $0.79 USD In Stock

Share