[wellylug] vi(m) question.
Sam Cannell
sam at plaz.net.nz
Fri May 7 23:57:20 NZST 2004
1 first line
2 second line
3 third line and we want to leave this alone
4 fourth line
5 fifth line
6 sixth line and this stays the same too.
:%s/^\( \+\)/newtext\1/
1 newtext first line
2 newtext second line
3 third line and we want to leave this alone
4 newtext fourth line
5 newtext fifth line
6 sixth line and this stays the same too.
If you use '\s' instead of ' ', it'll match other whitespace characters
like tabs:
:%s/^\(\s\+\)/newtext\1/
There may be characters other than space and tab that it matches - I
don't remember off the top of my head. :)
-----Original Message-----
From: wellylug-admin at lists.naos.co.nz
[mailto:wellylug-admin at lists.naos.co.nz] On Behalf Of Enkidu
Sent: Friday, 7 May 2004 10:05 p.m.
To: wellylug at lists.naos.co.nz
Subject: Re: [wellylug] vi(m) question.
What if *some* of the lines already had something there?
1 first line
2 second line
3third line and we want to leave this alone
4 fourth line
5 fifth line
6sixth line and this stays the same too.
More information about the wellylug
mailing list