Adding to the front of a line
loic.grenie at gmail.com
Wed Jan 21 18:46:29 UTC 2009
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> wrote:
>> 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 <return>
>> 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
(two keys less).
More information about the ubuntu-users