Page 1 of 1

Adding extra rows to a plain text file

Posted: Wed Sep 21, 2022 4:26 pm
by dakanga

Does anyone know how to add, for example, an extra twelve lines to a plain text file, such as in Windows Notepad (2005 to present, ), or some some other editor.
![](https://5.imimg.com/data5/SELLER/Defaul ... 50x250.png)
(it is the simple word pad that is available in Microsoft windows operating system - it is what I also use to create resources. I also use Google spread sheet. But I can use other editors/spreadsheets - if they are available to me for free. I like learning new things.)

What I want to do is in a text file that shows the words "SHOW MORE", to add an extra 12 blank lines after it.

example of text file content :

text 1
text 2
text 3
SHOW MORE
text 4
text 5
SHOW MORE
text 6
text 7
text 8
text 9
SHOW MORE
text 10
text 11


Re: Adding extra rows to a plain text file

Posted: Wed Sep 21, 2022 5:19 pm
by Cifi

You might give Notepad++ a try, it is a simple plain text editor (with some extra features for coding like e.g. syntax highlighting), and it has excellent search and replace features that allow about any text manipulation you can think of.


Re: Adding extra rows to a plain text file

Posted: Wed Sep 21, 2022 6:32 pm
by dakanga

ohhhhhhh !!!!!! I am in LOVE with Notepad++ !!!!!!

(These sorts of things ... they change my life !)

Thanks [mention]Cifi[/mention]


Re: Adding extra rows to a plain text file

Posted: Wed Sep 21, 2022 6:46 pm
by Cifi

I just tested it, seems to work like a charm.

You would need to use the search mode "extended", then
SHOW MORE
as search string and assuming you have windows-style line breaks*
SHOW MORE\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n
as replacement string.

You can check "Match case" to make sure any occurences of "show more" within the texts are excluded, and you actually can apply this to several files at once (nice feature, too).

(* you can look at the line breaks via "View -> Show Symbols -> Show End of Line". Windows style would display CR LF, while Mac OS uses CR only and Linux LF.)

Before:

text 1
text 2
text 3
SHOW MORE
text 4
text 5
SHOW MORE
text 6
text 7
text 8
text 9
SHOW MORE
text 10
text 11

After:
(the forum doesn't display these consecutive line breaks, probably needs code formatting?)

Code: Select all

text 1
text 2
text 3
SHOW MORE












text 4
text 5
SHOW MORE












text 6
text 7
text 8
text 9
SHOW MORE












text 10
text 11

Re: Adding extra rows to a plain text file

Posted: Wed Sep 21, 2022 6:47 pm
by Cifi
dakanga wrote: Wed Sep 21, 2022 6:32 pm

ohhhhhhh !!!!!! I am in LOVE with Notepad++ !!!!!!

So am I :D


Re: Adding extra rows to a plain text file

Posted: Sat Sep 24, 2022 3:18 am
by gmads
dakanga wrote: Wed Sep 21, 2022 4:26 pm

Does anyone know how to add, for example, an extra twelve lines to a plain text file, such as in Windows Notepad (2005 to present, ), or some some other editor.

You can do that with "regular expressions" ("regexp"). Any modern text editor will include the option to enable them in their Search and Replace function.

The following sites might be of help in learning about them. It is worth the effort as they are a very powerful tool.


:hash:  ㆍenglish ㆍgeneral ㆍinteresting