How do I split a wrapped numeric list into several lines?

2

I have some text in this format all on 1 line:

1v YHWH said, Let us make man in our image, after our likeness, and God created man in his own image. 2v And God formed man from the ground, and he blew into his nostrils the breath of life, and man became a living soul endowed with speech. 3v And the Lord said, It is not good for man to be alone; I will make unto him a helpmeet. 4v And the Lord caused a deep sleep to fall upon Adam, and he slept, and he took away one of his ribs, and he built flesh upon it, and formed it and brought it to Adam, and Adam awoke from his sleep, and behold a woman was standing before him. 5v And he said, This is a bone of my bones and it shall be called woman, for this has been taken from man; and Adam called her name Eve, for she was the mother of all living.

I want to look like this:

1v YHWH said, Let us make man in our image, after our likeness, and God created man in his own image.
2v And God formed man from the ground, and he blew into his nostrils the breath of life, and man became a living soul endowed with speech.
3v And the Lord said, It is not good for man to be alone; I will make unto him a helpmeet.
4v And the Lord caused a deep sleep to fall upon Adam, and he slept, and he took away one of his ribs, and he built flesh upon it, and formed it and brought it to Adam, and Adam awoke from his sleep, and behold a woman was standing before him.
5v And he said, This is a bone of my bones and it shall be called woman, for this has been taken from man; and Adam called her name Eve, for she was the mother of all living.

I did a regular expression replace like Find: "(\d+)" Replace: "\n$1"
I tried a bunch different ways like: --wrap around-regular expression --down [cursor at end]

This would get all the verses in order but it would change all the verse numbers to 1?

user83705

Posted 2011-11-08T17:41:12.820

Reputation: 83

What is your question? – Shinrai – 2011-11-08T17:51:12.523

Since it's windows it kind of depends on what editor you use. – Nifle – 2011-11-08T17:57:55.410

Did you forget the newline before 4v? – Daniel Beck – 2011-11-08T19:57:08.407

Answers

8

If you install Notepad++, you can use regular expressions in its Replace with function. Your attempt is almost correct.

  • Find what: (\d+)v
  • Replace with: \n\1v

Note that I used \1 instead of $1.

enter image description here

Nifle

Posted 2011-11-08T17:41:12.820

Reputation: 31 337

2I get more respect for Notepad++ every day – Ivo Flipse – 2011-11-08T19:53:49.863

1Scintilla Text Editor handles RegExp too. – music2myear – 2011-11-08T21:51:15.547

1yeah I've done similar split operations with N++, FTW! – Sathyajith Bhat – 2011-11-10T07:05:24.223

3

If you like to work from the command line, using sed, this is simply:

C:\> sed -i 's/\([0-9]\+\)v/\n\1/g' path\to\yourfile.txt

Eric Wilson

Posted 2011-11-08T17:41:12.820

Reputation: 6 388

I'll add my upvote if you edit your question to include how to install sed for windows. – Nifle – 2011-11-11T19:01:12.447

1Met you halfway, by including a link for sed for Windows. Personally, I use Cygwin, but that seems like overkill (and certainly no easier than installing NPP.) – Eric Wilson – 2011-11-11T19:16:01.557