Dear anyone,
Your duolingo forum registration isn't automaticaly transferred to duome forum so in order to join duome forums you need to register with your existing or any other username and email; in any case it's advised that you choose a new password for the forum.
~ Duome Team

Adding extra rows to a plain text file

Ask, and it will be given to you


User avatar
dakanga
Australia

Adding extra rows to a plain text file

Post 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.
Image
(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

learner, guide, seeker for enabling others. ... Kindness is not a luxury, it is a necessity.
smile, open your eyes, love and go on

Cifi

Re: Adding extra rows to a plain text file

Post 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.

Last edited by Cifi on Wed Sep 21, 2022 6:50 pm, edited 1 time in total.

Native: :de: Intermediate: :uk: Lower intermediate: :es: Beginner: :fr: Absolute beginner: 🇬🇷
(If there are errors in what I'm writing in either language, please do correct me - I'll never take it as offense or something like that.)

User avatar
dakanga
Australia

Re: Adding extra rows to a plain text file

Post by dakanga »

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

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

Thanks @Cifi

learner, guide, seeker for enabling others. ... Kindness is not a luxury, it is a necessity.
smile, open your eyes, love and go on

Cifi

Re: Adding extra rows to a plain text file

Post 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
Last edited by Cifi on Wed Sep 21, 2022 6:49 pm, edited 1 time in total.

Native: :de: Intermediate: :uk: Lower intermediate: :es: Beginner: :fr: Absolute beginner: 🇬🇷
(If there are errors in what I'm writing in either language, please do correct me - I'll never take it as offense or something like that.)

Cifi

Re: Adding extra rows to a plain text file

Post by Cifi »

dakanga wrote: Wed Sep 21, 2022 6:32 pm

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

So am I :D

Native: :de: Intermediate: :uk: Lower intermediate: :es: Beginner: :fr: Absolute beginner: 🇬🇷
(If there are errors in what I'm writing in either language, please do correct me - I'll never take it as offense or something like that.)

User avatar
gmads
Mexico

Re: Adding extra rows to a plain text file

Post 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.

To know the Dark Side is to bring balance to the Force.

:mexico: :us:  ·  :it: :brazil:  ·  :ru: Image

Post Reply

Return to “Requests”