Hello, @evguenii-baranov and All,
Quite easy with regular expression !
So, let’s suppose that your file contains only the simple text, below :
This is
a very
small bunch
of text
to see
if it
works nicely
Open your file in Notepad++
Place the caret ( cursor ) on the first line which must be replaced ( Line This is ). This point is IMPORTANT !
Open the Replace dialog ( Ctrl + H )
Un-check all the box options ( IMPORTANT )
SEARCH (?-is).+\R(?=(?:.+\R){2}(.+\R))
REPLACE $1
Select the Regular expression search mode
Click ONCE only on the Replace All button
=> You should get your expected text :
of text
to see
if it
works nicely
to see
if it
works nicely
Then, you just have to get rid of the three last lines which are repeated :
of text
to see
if it
works nicely
In a general way, if you must replace the first line by the line N, use the following generic regex :
SEARCH (?-is).+\R(?=(?:.+\R){N-2}(.+\R))
REPLACE $1
And replace the N-2 expression with its appropriate number !
so, for example, the different regex searches, below, may be used :
(?-is).+\R(?=(?:.+\R){0}(.+\R))
(?-is).+\R(?=(?:.+\R){1}(.+\R))
(?-is).+\R(?=(?:.+\R){5}(.+\R))
Best Regards,
guy038