How i use replace commands
-
i want use the replace command to put the number of line
find x
replace x<number of line>
will be like this
x1
x2
x3
x4and where i find the instruction for more commands.
-
You could do that by
- using the block editor to insert line numbers at the beginning of all lines.
- using a regular expression to do your replacements.
- removing the line numbers added in step 1.
At first place the cursor to the beginning of the document (line 1, column 1) then open the Column Editor. You can find it under
Edit (menu) -> Column Editor...
(default shortcut ALT+C).- Choose
Text to Insert
, enter a SPACE character in the input field and clickOK
. - Open the Column Editor again. Choose
Number to Insert
, setInitial Number
to 1, setIncrease by
to 1, leave theRepeat
field blank , choose underFormat
the itemDec
and clickOK
.
Now every line of your document should be preceded by its line number, separated by a SPACE character.
Now open the
Find & Replace
dialog. Tick theWrap around
checkbox and underSearch mode
chooseRegular expression
. In theFind what
field type^([0-9]+) (.*?x)(.*)
(Note:x
is your search term ) and in theReplace with
field type\1 \2\1\3
. Then clickReplace All
.As the last step remove the line numbers by using the column editing mode. Set the cursor to the beginning of the document and press ALT+SHIFT+Down until you’ve reached the end of the document. Now you can delete the line numbers and the trailing SPACE characters by pressing the DELETE key.
The regular expression I provided above may or may not fit your needs, you have to try. If it doesn’t work come back and provide specific informations about the problem.