I am using Notepad++ to edit a text file that has been poorly encoded log. The program didn't take into account the AZERTY keyboard layout of the user. The result is a text file as follows (example I made up)
Hi guysm this is Qqron<
I zonder zhen ze cqn go to the szi;;ing pool together
:y phone nu;ber is !%%)@!#@@#(
Cqll ;e/
I need to make bulk replacement of characters as follows
a > q
q > a
[/0] > 0
! > 1
and a few others
Is it possible to create a table of characters to be replaced ? I'm a bit of a beginner and I don't know whether Notepad++ allows to run scripts
Open the text file in Notepad. Click Edit on the menu bar, then select Replace in the Edit menu. Once in the Search and Replace window, enter the text you want to find and the text you want to use as a replacement. See our using search and replace and advanced options section for further information and help.
Notepad++ is very good at this kind of task. It has a Search and Replace feature which lets you specify a regular expression (also known as "RegEx") for the text to find and its replacement. You can access it from the Search menu or by pressing Ctrl+H.
Notepad++ has a macro recorder, but macros can't be written in any documented embedded language. You could potentially record a macro that does 70 or so search and replace operations. See this explanation. There is some information on "hacking" the macro language here.
Clearly Notepad++ was not meant for this task. The Python solutions are okay, but Perl was meant originally for stuff exactly like this. Here's a one-liner. This is for Windows. In bash/Linux, replace the double quotes with single ones.
perl -n -e "tr/aqAQzwZW;:!@#$%^&*()m\/</qaQAwzWZmM1234567890:?./;print"
It will do what @kreativitea's solution does (I used his translation strings), reading the standard input and printing to standard output.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With