You are not logged in.
Hello everybody!
I am trying to insert new line in a file that looks like
C89 Ruy Lopez, Marshall, Herman Steiner variation1. e4 e5 2. Nf3 Nc6 3. Bb5 a6 4. Ba4 Nf6 5. O-O Be7 6. Re1 b5 7. Bb3 O-O 8. c3 d5 9. exd5 e4
C90-C99 Ruy Lopez, closed1. e4 e5 2. Nf3 Nc6 3. Bb5 a6 4. Ba4 Nf6 5. O-O Be7 6. Re1 b5 7. Bb3 O-O 8. c3 d6I want to insert the new line before every '1.' characters.
After some goooooooooooogling I tried diff variations that did not work I finally realised I need to put '\' in front of the '.' to make it work
:1,$s/1\./\r1\./gIt worked but it also included a new line every time it found '11.' turning it into
1
1.What is the right command that will not affect lines with '11.'?
Thank you in advance!
Last edited by amaro (2021-11-02 12:49:16)
Offline
I want to insert the new line before every '1.' characters.
That's exactly what the command you have given does.
Do you want to specifically exclude 11. ? What about 21.?
This looks like some sort of bibliography and your trying to separate some enumeration from the beginning?
Assuming just ASCII for now you could try something with capture groups
%s/\(\a\)1./\1\r1./Edit: or just remove the global if they are ordered and 11. does not come before 1.
Last edited by lmn (2021-11-02 12:29:40)
Offline
Thank you, lmn!
Yes, it's ordered. Removing the global did it. I overlooked it.
Your command worked too!
Offline