Good Day All,
I need a little help in the find and replace function.
I have a block of codes which looks like this :
%MPF9999
N0040 R409=0004 R410=1000 L806
N0050 M01
N0060 M08
N0070 R409=0004 R410=1002 L806
N0080 M01
Following is the result that I'm looking for :
%MPF9999
:0040 R409=0004 R410=1000 L806
N0050 M01
N0060 M08
:0070 R409=0004 R410=1002 L806
N0080 M01
In other words, find the line which contains R409, move the cursor the beginning of the line and replace the letter "N" with ":".
Thanks
Find & Replace
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
-
Jens Hollmann
Re: Find & Replace
Well there are several ways to do this, I think. The find & replace solution:
find: ^N\(.*\)R409
replace: :\1R409
Turn "regular expressions" on. You should not have activated the POSIX standard for regular expressions. Short explanation:
^ matches the beginning of a line
N matches this letter
.* matches really anything (except newlines)
\( \) marks this "anything" so that we can use it in the replace part
R409 matches exactly this
: is the ":" you wanted instead of the "N"
\1 is the "anything" we matched in the find part
R409 with this the found R409 is replaced by itself
The other method would be to record a macro. You already described what to record.
Does HTH mean Hope To Help? If so: HTH
find: ^N\(.*\)R409
replace: :\1R409
Turn "regular expressions" on. You should not have activated the POSIX standard for regular expressions. Short explanation:
^ matches the beginning of a line
N matches this letter
.* matches really anything (except newlines)
\( \) marks this "anything" so that we can use it in the replace part
R409 matches exactly this
: is the ":" you wanted instead of the "N"
\1 is the "anything" we matched in the find part
R409 with this the found R409 is replaced by itself
The other method would be to record a macro. You already described what to record.
Does HTH mean Hope To Help? If so: HTH
-
Roy Beatty
Re: Find & Replace
HTH = Hope that helps (at least that's what *I* mean when I use it)