I have a macro with two steps.
The first step deletes all lines that do not match a regular expression.
The second step then attempts a replace, where there are multiple occurrences to replace.
The problem lies in the second step.
During macro recording, the replace operation successfully finds and replaces all occurrences of the "Find what" expression; however, during macro playback, it only finds and replaces the first occurrence.
To replicate:
Create the following file, call it dummy.txt:
Code: Select all
0
12
abcdxefxxgh
*$4
zzRecord the following macro (keystrokes in grey italics, things to type in blue bold, my comments after "//" in green):
- F5 // Step 1, remove each line not beginning with "a"
alt+I
^a
alt+M // 1.1. Bookmark each line that starts with an "a"
Esc
alt+S // 1.2. Invert bookmarked lines
A
alt+E // 1.3. Delete lines now bookmarked (i.e., not starting with "a")
L
B
F8 // Step 2, put a newline after every x
alt+I
x // 2.1. Find each "x"...
alt+P
&\n // 2.2....to be replaced by "x" plus newline
alt+A // 2.3. Replace All
Esc
Code: Select all
abcdx
efx
x
ghCode: Select all
abcdx
xefxxghHelios, is this a bug? Is there a workaround that doesn't involve two separate macros?
Thanks,
Art Metzer