Unix Technical Forum

paste multiple lines with sun vi

This is a discussion on paste multiple lines with sun vi within the Sun Solaris Administration forums, part of the Solaris Operating System category; --> I was convinced this was a moment of retardation at first. The machines are all solaris 10, various updates ...


Go Back   Unix Technical Forum > Unix Operating Systems > Solaris Operating System > Sun Solaris Administration

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-09-2008, 02:34 PM
Cydrome Leader
 
Posts: n/a
Default paste multiple lines with sun vi

I was convinced this was a moment of retardation at first.

The machines are all solaris 10, various updates and various hardware.
Mission was to copy and paste a line in vi say 500 times. I tried the
usual yy, to copy the line I wanted, then 500p

It only pasted one line. Tried a bunch of other machines, no dice.

Had another person try the same task, they failed as well and were like
WTF is going on here.

Talked to the programmers, they only use vim, where this does work. I come
from a BSD world, where vi is really nvi, and this works just fine.

Is there a reason this pretty basic behavior doens't work on the sun
standard vi, or is there something that would make it not work?


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 03-17-2008, 07:04 AM
Greg Andrews
 
Posts: n/a
Default Re: paste multiple lines with sun vi

Cydrome Leader <presence@MUNGEpanix.com> writes:
>
>The machines are all solaris 10, various updates and various hardware.
>Mission was to copy and paste a line in vi say 500 times. I tried the
>usual yy, to copy the line I wanted, then 500p
>


IIRC, Sun's vi, like /bin/sh, traces its ancestry back to the version
provided in AT&T's SRV4 Unix almost 20 years ago (1989). Since the
SVR4 blend of BSD and System V Unixes was a joint project by AT&T and
Sun (and others), the Solaris vi might even go all the way back to the
original version created at Berkeley in the late 70s.

Occaisionally, I've noticed some inconsistencies in how the Solaris vi
handles count/repeat prefixes among the different commands. I just figured
they were things from the original code that Sun never enhanced.

I think the few times I've needed to replicate a single line in this way,
I did some manual yanking and pasting ('p' ten times, then '10yy' and 'p'
ten times, then '100yy' and 'p' 5 times). Or wrote a shell loop to append
the line to the file 500 times.

I've looked through my old O'Reilly nutshell handbook on vi and found
a couple of potential ways to do it with ex commands, but I don't have a
way to test them at the moment.

-Greg
--
Do NOT reply via e-mail.
Reply in the newsgroup.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 03-17-2008, 07:04 AM
Cydrome Leader
 
Posts: n/a
Default Re: paste multiple lines with sun vi

Greg Andrews <gerg@panix.com> wrote:
> Cydrome Leader <presence@MUNGEpanix.com> writes:
>>
>>The machines are all solaris 10, various updates and various hardware.
>>Mission was to copy and paste a line in vi say 500 times. I tried the
>>usual yy, to copy the line I wanted, then 500p
>>

>
> IIRC, Sun's vi, like /bin/sh, traces its ancestry back to the version
> provided in AT&T's SRV4 Unix almost 20 years ago (1989). Since the
> SVR4 blend of BSD and System V Unixes was a joint project by AT&T and
> Sun (and others), the Solaris vi might even go all the way back to the
> original version created at Berkeley in the late 70s.


that might be. I wish I had a running AT&T SV machine to test this on.

> Occaisionally, I've noticed some inconsistencies in how the Solaris vi
> handles count/repeat prefixes among the different commands. I just figured
> they were things from the original code that Sun never enhanced.


Pasting single characters with repeat seems ok. The odd part is not that
repeat pasting of lines doesn't work, but that I haven't noticed it until
now.

> I think the few times I've needed to replicate a single line in this way,
> I did some manual yanking and pasting ('p' ten times, then '10yy' and 'p'
> ten times, then '100yy' and 'p' 5 times). Or wrote a shell loop to append
> the line to the file 500 times.


I usually just hit p or . as many times as I need, and a few is usually
enough- it's never been hundreds before.

> I've looked through my old O'Reilly nutshell handbook on vi and found
> a couple of potential ways to do it with ex commands, but I don't have a
> way to test them at the moment.
>
> -Greg

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 03-17-2008, 07:04 AM
Rich Teer
 
Posts: n/a
Default Re: paste multiple lines with sun vi

On Sun, 9 Mar 2008, Greg Andrews wrote:

> IIRC, Sun's vi, like /bin/sh, traces its ancestry back to the version
> provided in AT&T's SRV4 Unix almost 20 years ago (1989). Since the
> SVR4 blend of BSD and System V Unixes was a joint project by AT&T and
> Sun (and others), the Solaris vi might even go all the way back to the
> original version created at Berkeley in the late 70s.


Given that vi's original author, Bill Joy, was one of Sun's founders, I
suspect the latter is very probably the case. ;-)

--
Rich Teer, SCSA, SCNA, SCSECA, OGB member

CEO,
My Online Home Inventory

URLs: http://www.rite-group.com/rich
http://www.linkedin.com/in/richteer
http://www.myonlinehomeinventory.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 03-17-2008, 07:04 AM
Greg Andrews
 
Posts: n/a
Default Re: paste multiple lines with sun vi

Rich Teer <rich.teer@rite-group.com> writes:
>On Sun, 9 Mar 2008, Greg Andrews wrote:
>
>> IIRC, Sun's vi, like /bin/sh, traces its ancestry back to the version
>> provided in AT&T's SRV4 Unix almost 20 years ago (1989). Since the
>> SVR4 blend of BSD and System V Unixes was a joint project by AT&T and
>> Sun (and others), the Solaris vi might even go all the way back to the
>> original version created at Berkeley in the late 70s.

>
>Given that vi's original author, Bill Joy, was one of Sun's founders, I
>suspect the latter is very probably the case. ;-)
>


True, though I found an August 1984 magazine interview where he said
at that point he'd been away from vi development for 4 or 5 years.
Also, I remember that in SunOS 4.1.3 vi was one of the very few apps
that used the SysV terminfo system rather than termcap. Made adding
new terminal types a PITA.

So he might have had less influence on the version of vi in Solaris
than his stature as a company founder would imply. It's hard to tell.

-Greg
--
Do NOT reply via e-mail.
Reply in the newsgroup.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 03-17-2008, 07:04 AM
Richard B. Gilbert
 
Posts: n/a
Default Re: paste multiple lines with sun vi

Greg Andrews wrote:
> Rich Teer <rich.teer@rite-group.com> writes:
>
>>On Sun, 9 Mar 2008, Greg Andrews wrote:
>>
>>
>>>IIRC, Sun's vi, like /bin/sh, traces its ancestry back to the version
>>>provided in AT&T's SRV4 Unix almost 20 years ago (1989). Since the
>>>SVR4 blend of BSD and System V Unixes was a joint project by AT&T and
>>>Sun (and others), the Solaris vi might even go all the way back to the
>>>original version created at Berkeley in the late 70s.

>>
>>Given that vi's original author, Bill Joy, was one of Sun's founders, I
>>suspect the latter is very probably the case. ;-)
>>

>
>
> True, though I found an August 1984 magazine interview where he said
> at that point he'd been away from vi development for 4 or 5 years.
> Also, I remember that in SunOS 4.1.3 vi was one of the very few apps
> that used the SysV terminfo system rather than termcap. Made adding
> new terminal types a PITA.
>
> So he might have had less influence on the version of vi in Solaris
> than his stature as a company founder would imply. It's hard to tell.
>
> -Greg


The guy who is running the company generally does not have the time or
the energy to do the grunt work as well. By the time you have ten
employees, supervising them is generally a full time job.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 03-17-2008, 07:04 AM
Jeff Wieland
 
Posts: n/a
Default Re: paste multiple lines with sun vi

In article <Pine.SOL.4.64.0803100711430.17600@marrakesh> Rich Teer <rich.teer@rite-group.com> writes:
>On Sun, 9 Mar 2008, Greg Andrews wrote:
>
>> IIRC, Sun's vi, like /bin/sh, traces its ancestry back to the version
>> provided in AT&T's SRV4 Unix almost 20 years ago (1989). Since the
>> SVR4 blend of BSD and System V Unixes was a joint project by AT&T and
>> Sun (and others), the Solaris vi might even go all the way back to the
>> original version created at Berkeley in the late 70s.

>
>Given that vi's original author, Bill Joy, was one of Sun's founders, I
>suspect the latter is very probably the case. ;-)
>
>--
>Rich Teer, SCSA, SCNA, SCSECA, OGB member
>
>CEO,
>My Online Home Inventory
>
>URLs: http://www.rite-group.com/rich
> http://www.linkedin.com/in/richteer
> http://www.myonlinehomeinventory.com


Back in my SVR3 days (on AT&T 3B2's no less), I did some digging into
issues with vi and xterm on SunOS 4 and SVR3. If you recall, in an
xterm on SunOS 4, vi would save and then restore the xterm window on
exit.

Bringing the xterms terminfo entry over to SVR3 on the 3B2's caused
this to not work quite right -- the window would be restored, but the
cursor would be left in the upper left hand corner of the xterm
window. Digging further, I found that the SVR3 vi had a screen
handling bug -- it would home the cursor before it sent the "start
of cursor motion" (smkx) sequence. We had a source license, and I
found and fixed the problem in my own local copy of vi (long since
gone along with the 3B2's). IIRC, it was just moving a line or two
of code and then compiling.

Guess what? The vi on Solaris 8 and 10 still has this bug. From
running vi inside of a script session:

Script started on Thu Mar 13 10:02:28 2008
/tmp>vi foo^M
^[[24;1H^[[?1h^[="foo" [Read only] 1 line, 256 characters

See, vi homes the cursor (^[[24;1H) and then send the smkx sequence
(^[[?1h^[=). This is backwards. I'd say that the vi on Solaris has
at SOME System 5 vi code in it. And this also explains why the
xterm windows are no longer restored on exiting from vi -- the fix
was to remove the save and restore sequences from smkx and rmkx.

Maybe I should open a bug report with Sun :-). The fix is likely
very trivial.
--
Jeff Wieland
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 06:07 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com