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++:
- 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++ Search & Replace: Click Search in the top navigation bar and then scroll down to click Replace as shown in the below example image.
Once you click Replace it will open the Replace tab in the Notepad++ Find window as shown below.
- 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.
- 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.
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.
The initial list of hashes will now all have :SHA at the end of each line as shown in the below example image.
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.