Just recently adopted N++ and it's already proven itself several times over. What I can't find in any documentation though is the ability to "insert" stuff before (and after) the end of a line
I have a list of IP's like this
What I want to do is:
a) insert this at the start of every line
-A INPUT -s
b) insert this at the existing end of each line
so that the finished result looks like this;
-A INPUT -s 10.1.1.1/32 -j DROP
Any guidance or help would be greatly appreciated!
Regards & TIA
Try using the Macro for this.
Place the cursor to insert at the beginning of the first IP address.
Select menu item: Macro>Start Recording
Enter the pre-fix "-A INPUT -s "
Select the 'end' key to move to end of line.
Enter the post-fix " -j DROP"
Select menu item Macro>Stop Recording
Re-run the macro through the list by selecting menu item Macro>Run the Macro Multiple Times.
Hope this helps.
By now, I guess you should have find a solution !
So, just for fun,
If you have Notepad++, since the 6.0 version, it's quite easy !
No need for scripting !
Select your file, containing IP addresses
Go back to the BEGINNING, with the CTRL + Home shortcut
CTRL + Home
Open the SEARCH-REPLACEMENT dialog, with CTRL + H shortcut
CTRL + H
Type in SEARCH .+
Type in REPLACEMENT -A INPUT -s $0 -j DROP
-A INPUT -s $0 -j DROP
Select the "Regular expression" search mode
Select the "Wrap around" box
Click on the "Replace All" button
That's all !
.+ , in SEARCH means ANY character, repeated, at least one time
$0 , in REPLACEMENT stands for the totality of the SEARCH string
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.