Adding to the front of a line
aart at mtack.xs4all.nl
Wed Jan 21 19:30:57 UTC 2009
On Wed, 21 Jan 2009 19:46:29 +0100, Loïc Grenié wrote:
> 2009/1/21 Brian McKee <brian.mckee at gmail.com>:
>> On Wed, Jan 21, 2009 at 1:07 PM, Smoot Carl-Mitchell <smoot at tic.com>
>>> On Wed, 2009-01-21 at 10:36 -0500, Brian McKee wrote:
>>>> I couldn't resist adding my first thought. Type as shown - case
>>>> matters! - white space only there for readability...
>>>> vi sites.txt <return> Control-v G I 127.0.0.1 <space> <Esc> :wq
>>> vi sites.txt<return>:g/^/s//127.0.0.1 /<return>ZZ
>> Well, I was trying to demo the program as well as provide a solution
>> :-) Yours is just confusing :-)
>> If we're playing Perl Golf with vim...
>> Try this one Ray - just copy and paste and you're done.
>> vi -c ':g/^/s//127.0.0.1 /' -c ':wq' sites.txt
> You can change
> :g/^/s//127.0.0.1 /
> :%s/^/127.0.0.1 /
> (two keys less).
And can't you change :wq in :x
(even one key less)
More information about the ubuntu-users