find a string and move to new line
-
I would like split line into a new line after finding a specific character
Eg.
edit "*.pokotalks.com" set type fqdn set fqdn "*.pokotalks.com"
should become like below
edit "*.pokotalks.com" set type fqdn set fqdn "*.pokotalks.com"
—
moderator added code markdown around text; please don’t forget to use the
</>
button to mark example text as “code” so that characters don’t get changed by the forum -
You don’t say what the “specific character” is, and there is no specific character in your example data. But if what you want is to convert space character followed by
set
to newline sequence followed byset
(but only ifset
is a whole word, not the start of some other word likesetting
), an easy way to do that is:- FIND WHAT =
\x20set\b
- the
\x20
means the space character; if you wanted, you could just type a space as the first character in FIND WHAT, but it’s hard to copy/paste unnoticed space character from the forum, so I use the escape sequence instead - the
\b
is what keeps it matchingset
but notsetting
- the
- REPLACE WITH =
\r\nset
\r\n
is the windows CRLF line ending.
- SEARCH MODE = Regular Expression
- Click REPLACE ALL
There are other ways to do it, but this one is pretty easy for a regex (regular expression) newbie to understand
(update: fixed from saying wrong
\x32
to right\x20
)----
Useful References
- FIND WHAT =