Adding to the front of a line

Smoot Carl-Mitchell smoot at tic.com
Wed Jan 21 18:07:48 UTC 2009


On Wed, 2009-01-21 at 10:36 -0500, Brian McKee wrote:
> On Tue, Jan 20, 2009 at 12:12 AM, Ray Parrish <crp at cmc.net> wrote:
> > Ray Parrish wrote:
> > LOL! Well, I should have came back to my email sooner, and read all of
> > these excellent replies, it would have saved me a lot of head
> > scratching! Thanks for the tips on different methods of accomplishing
> > this task.
> 
> 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>
> 
> I think I win for fewest keystrokes - and you can see what you're
> doing as an added bonus :-)

Or

vi sites.txt<return>:g/^/s//127.0.0.1 /<return>ZZ

vi is such a hack at times, but I have it wired in my spine. :-)
-- 
Smoot Carl-Mitchell
Computer Systems and
Network Consultant
smoot at tic.com
+1 480 922 7313
cell: +1 602 421 9005




More information about the ubuntu-users mailing list