Adding to the front of a line

Brian McKee brian.mckee at gmail.com
Wed Jan 21 18:44:17 UTC 2009


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>

> Or
>
> 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




More information about the ubuntu-users mailing list